skip to Main Content

Their is a way to get a facebook page id via get request? Or i need to send also a access token ?

For the second option. I have a facebook application. How i can get the facebook page id?

I use this code (Extracting page id from a facebook page url):

$fbUrl = "https://www.facebook.com/Lo-stile-di-Anna-
1521824524722026";
$graphUrl = "https://graph.facebook.com/?id=".$fbUrl."&access_token=xxxxx&fields=id";
$output = file_get_contents($graphUrl);
$output = json_decode($output, TRUE);
echo $output["id"]; // returns 1521824524722026

As you can see i need the access_token parameter. How can i obtain it automatically (via script call) or how can it stay permanent?

Thank you!

2

Answers


  1. I’ve used the facebook SDK in past but with PHP.

    Every request need that you have an access token setted and a facebook app id configured. So, i think that it’s not possible to access the resource you need without a token.

    Read the facebook API documentation for more info about Facebook Developers

    Login or Signup to reply.
  2. You can use an App Access Token, it is just a combination of App ID and App Secret with a pipe sign: App-ID|App-Secret

    You get the ID of a page with this API call: graph.facebook.com/bladauhu?access_token?xxx

    More information about Tokens:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search