I have a facebook tab application that has an URL. I want to pass the URL some GET parameters. Normally this is how I do a signed request to get user data:
if ($signed_request = parsePageSignedRequest()) {
$config = array(
'appId' => $app_id,
'secret' => $app_secret,
);
$facebook = new Facebook($config);
$ret_obj = $facebook->api('/me', 'GET', array());
$theemail = $ret_obj['email'];
$thename = $ret_obj['name'];
$theusername = $ret_obj['username'];
}
I was wondering how to get the GET parameter from the url. The url looks like:
https://www.facebook.com/pages/Msomepagey/23023424231927?sk=app_518726691484563&user=someuser
I want to get the value for user
.
Any ideas?
You need to use the
app_data
parameter. Facebook would read this parameter and pass it to your app within the request:On a side note, you can use the PHP-SDK to also get the signed request like this:
More here: https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L489
Also you need to check if you actually have a valid user session before calling
/me
, I suggest you have a look at the PHP-SDK example.