If you need to send URL variables into a Facebook App (within a Page tab), doing so is surprisingly easy.
Firstly, know that the JSON-based object you are interacting with is called signed_request. It is used primarily for internal communication between Facebook and your app. However, Facebook does give you one app_data variable to use for your own variables. To send a variable to your Facebook app, all you need to do is set a value to app_data in your URL request and Facebook will handle communicating that data to your app’s iFrame.
URL example (sending data):
https://www.facebook.com/pages/Walrus-In-A-Canoe/?sk=app_0000000000&app_data=APP_DATA_CONTENT
For an example of retrieving your app_data, I have found some nifty code from fbadurbin on this thread which I have pasted below.
$signed_request = $_REQUEST['signed_request']; // Get the POST signed_request variable.
if(isset($signed_request)) // Determine if signed_request is blank.
{
$pre = explode('.',$signed_request); // Get the part of the signed_request we need.
$json = base64_decode($pre['1']); // Base64 Decode signed_request making it JSON.
$obj = json_decode($json,true); // Split the JSON into arrays.
$page = $obj['page']; // Get the page array. It has a sub array.
echo("Your App Data: " . $obj['app_data']);
}
else
{
die('No signed request avaliable.'); //If there is no signed_request, stop processing script.
}










