maybe its a tricky question but anyway:
I have a facebook application running on an outside server. Lets say my canvas url is
http://mydomain.com/myapp/
This is integrated into a page, and I can reach the app with an url like
http://facebook.com/mypage/app_123456789
where 123456789 is my Application ID
Users can share certain things on their walls, and that share contains an url back to my app.
So lets say I have a content shared, it has an url like
http://mydomain.com/myapp/content/1
This is where the user goes if he clicks on the wall post.
Now my problem is obviously that I want this url to get redirected back to my facebook PAGE.
It’s easy to redirect everything to
http://facebook.com/mypage/app_123456789
but that takes me to the main page of my application, not to the specific content the user shared.
Is there a way to do this? Like, I can pass a parameter to facebook to tell which page I want to load?
Yes you can! Facebook doesn’t pass any old parameters you give when being redirected to an application’s canvas page, but if you manipulate the parameters in a certain way, you’ll gain access to them.
You’ll have to pass all your parameters in the following format –
Once you reach your canvas URL, you can retrieve the data in
app_datafrom within thesigned_request. Once you have the contents of the parameter, you should have something like this –Now it is just an issue of parsing that string into an array of keys and values. In this specific example, I’ve chosen a dolar character to separate the keys from the values, but as you can see from the code below, you can use whatever you want to separate the parameters and key/value pairs –
At this stage your
$getParamsarray should look something like thisNow that you can pass parameters to your application, you’ll be able to decide what content to show according to the data passed to it from the referring URL.