0

here i am checking for and getting part of the request, (the ids). i also print out the entire request:

if (isset($_REQUEST['ids'])){
    $amount = sizeof($_REQUEST['ids']);
    print_r($_REQUEST);
    echo "<br>$amount invitations Successfully Sent";
}

this is how the entire $_REQUEST prints out:

Array
(
    [mfs_typeahead_req_form_4cf74f96db3688507476560] => Start Typing a Name
    [ids] => Array
        (
            [0] => 510149460
        )
    [fbs_258181898823] => \"access_token=258181898823|2.q_qb_yoReO0_xc4H8PxKRQ__.3600.1291280400-100000664203700|LqtGr_OiJTASGmek61awxmxfvFk&expires=1291280400&secret=85eTEELZj8lkV82V_PwRSA__&session_key=2.q_qb_yoReO0_xc4H8PxKRQ__.3600.1291280400-100000664203700&sig=d4cc0e4c0992ea29c0adfd60dc27185b&uid=100000664203700\"
)

i need to parse the part at the end: &uid=100000664203700, specifically '100000664203700'

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
chris
  • 11
  • 4

4 Answers4

1
$queryString = $_REQUEST["fbs_258181898823"];
$output = array();
parse_str($queryString, $output);
print $output["uid"];
Paul Schreiber
  • 12,531
  • 4
  • 41
  • 63
0

parse_str() will break up things that look like a query string. I recommend you pass an array as the second parameter.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
0

You can use parse_str()—it should do the trick.

Count Chocula
  • 1,041
  • 8
  • 4
0

First, remove the \" (using a combination of preg_replace and stripslashes) at the beginning and the end, then use parse_str:

$str = preg_replace('/(^"|"$)/', '', stripslashes($_REQUEST['fbs_258181898823']));
parse_str($str, $data);
$uid = $data['uid'];
netcoder
  • 66,435
  • 19
  • 125
  • 142