nasirkhan
nasirkhan

Reputation: 10553

how to get page id when installing a iframe page tab on facebook?

I want to create a simple facebook page tab. Where i want that, if a user install this app to a page the page id will be stored in my database. Then i will show different content for individual fb pages. I read some documents where it is mentioned that signed_request could be used to get the page id. but signed request it received after the page is loaded into some fb page.

As anyone can install my app it is not possible to know who is going to install the next. but i have a plan to show different pages(from my server) in different page (in Facebook) tabs.

Upvotes: 1

Views: 1950

Answers (3)

Grzegorz Pawlik
Grzegorz Pawlik

Reputation: 2216

Courtesy dk1, precisely $_REQUEST['fb_page_id'] made it work.

Upvotes: 1

Parcye
Parcye

Reputation: 98

Just noticed that it is now an array, named tabs_added . The key of the array is the page ID and the valude is 1 (true) for tabs added. This would give you the idea that the other page ID keys would be in the array with 0 (false), but they are not passed.

<?
// grab all keys in an array
$aKeys = array_keys($_REQUEST['tabs_added']);
// take the first key - this is one of the page ID's the tab was added to
$sFirstKey = array_shift($aKeys);
?>

Upvotes: 3

dk1
dk1

Reputation: 529

Facebook will call your Application URL when someone is installing you app as a page tab. Do there some $_REQUEST logging to find out which params Facebook is sending in that case. There is one value that identifies the page where the application got added. I've done this already but have no sample code here atm to show you.

Upvotes: 0

Related Questions