I want to get and use Page ID in several php files.
However I can get it now only on the landing page. Even the same code but in a linked php file does not retrieve the ID.
Could you please tell me what I am doing wrong?
Here is the example:
https://www.facebook.com/pages/PetAi/258812190823241?sk=app_236464646413556
<?php
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'xxx',
'secret' => 'xxx',
));
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request['page']['id'];
echo "Page ID: $page_id <br /><br />";
echo "<a href=\"https://www.yaku.ru/facebook/petai/question2.php\" />A page with the same code.</a>";
?>
The easiest way would probably be to add the Page ID to the session so you can use it on any page after that.