I have developed a facebook canvas app which posts to users newsfeeds and I want to be able to allow users to click on the link in the newsfeed and be taken to my app along with some data that will be presented in the app (for example by passing it in the querystring).
When I create the link that will be posted on user's newsfeed I set the link field to -
http://apps.facebook.com/myappname/?datatopass=mydata
This works, when a user clicks this link the browser directs them to that link. However I cannot access the $_GET['datatopass'] variable (using PHP) and it appears to be blank. I have tried using javascript to output the window.location variable and I don't see my passed querystring, even though I see the url as it is above in my browser address bar. What I do see is the site url that i set up in the facebook developer app and the state and code params that facebook uses. It has stripped my datatopass param that I wanted to be able to read when my app launched.
So ... how can I pass along the data that I want to send? I know there is an app_data field if you are using signed_request but as I understand it this is only good for apps that sit in a Tab of a Page. I am using the iFrame canvas app method.
When I look at my apache server's access logs I can see that there is a POST entry for my site url address with my appended querystring -
my.domain.com 123.456.7.890 - - [23/Feb/2012:14:21:19 +0000] "POST /facebookapp/?datatopass=mydata HTTP/1.1" 200 300 "http://apps.facebook.com/myappname/?datatopass=mydata" "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0"
Followed by a GET entry -
my.domain.com 123.456.7.890 - - [23/Feb/2012:14:21:20 +0000] "GET /facebookapp/directory/?state=99226fiawhoidhaoia09809a085d94832&code=ahfakshdlkfhalksj.... HTTP/1.1" 200 27094 "http://my.domain.com/facebookapp/?play=asd" "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0"
My apologies I dont really understand what the above is doing but hoped it would be useful extra information in helping to answer this.