I'm trying to pass some data using GET method on my iframe facecbook app , but inside the page there is no data , my code is
<?php
echo '<pre>';
print_r($_GET);
die()
?>
and trying to pass like apps.facebook.com/APPNAME/?p=23
or apps.facebook.com/APPNAME/index.php?p=23
You can' directly pass a variable into the iframe, you need the app_data in the signed request. Look at these similar questions and answers:
- Bookmark facebook app with parameter
- Pass variables into Facebook iFrame app PHP
Forget what the other poster said. Normal canvas apps do not accept the app_data parameter, only tab apps do. But you can use custom URLs beyond just the canvas URL. Let me show you how this works.
My App:
I have an app called PulseTrack. The main App URL is:
http://apps.facebook.com/pulsetrack/
Which points to this canvas URL:
http://mydomain.com/pulsetrack/
But I can also use this url:
http://apps.facebook.com/pulsetrack/watch/EP011583610051
Which points to:
http://mydomain.com/pulsetrack/watch/EP011583610051
Your app
Using straight up PHP if you can setup your canvas URL like this:
http://yourdomain.com/index.php?
Then you can pass directory parameters to the end of your URL like so:
http://apps.facebook.com/your-app/your/awesome/params
Which will come to you like this:
http://yourdomain.com/index.php?/your/awesome/params
Something like this should be able to parse those "parameters" from the query string
$query = $_SERVER['QUERY_STRING'];
$params = explode("/", $query);
Best of luck, this took me a long to figure out.
You can just pass the paramater in as per normal. Facebook will append it to the URL when it loads the iframe so what you are doing should in theory be working. Facebook actually does a HTTP POST when loading in the iframe however the resource will contain the query string you specify so in PHP $_GET should be filled in. How exactly are you passing the paramater? Give us an example of your code with link included.