ERROR: Unsupported request for receipt. Please read Graph API documentation

I am trying to access information about my Facebook page using cURL. I passed url / accounts to Graph Explorer, which shows some data as follows:

{
  "data": [
    {
      "access_token": "tokenString", 
      "category": "Small business", 
      "name": "myPageName", 
      "id": "xxx", 
      "perms": [
        "ADMINISTER", 
        "EDIT_PROFILE", 
        "CREATE_CONTENT", 
        "MODERATE_CONTENT", 
        "CREATE_ADS", 
        "BASIC_ADMIN"
      ]
    }
  ], 
  "paging": {
    "cursors": {
      "before": "MTM4NzYwMjM5NDg5NTUzOQ==", 
      "after": "MTM4NzYwMjM5NDg5NTUzOQ=="
    }
  }
}

But when I tried to get the same in cURL and run through the terminal, it gave me the error " Unsupported GET request "

The code:

<?php
  $url='https://graph.facebook.com/v2.3/me/accounts';
  $ch=curl_init();
  CURL_SETOPT($ch,CURLOPT_URL,$url);
  CURL_SETOPT($ch,CURLOPT_RETURNTRANSFER, 1);
  $json=json_decode(curl_exec($ch));
  var_dump($json);
?>

Error:

object(stdClass)#1 (1) {
  ["error"]=>
  object(stdClass)#2 (3) {
    ["message"]=>
    string(114) "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"
    ["type"]=>
    string(20) "GraphMethodException"
    ["code"]=>
    int(100)
  }
}

Page Resolution: manage_pages,publish_pages

I checked age limits: it is open to everyone.

Then where am I going wrong? Thanks for any help

+4
source share
1 answer

Graph Explorer . cUrl URL-, .

access_token manage_pages ( {access_token}).

<?php
  $url='https://graph.facebook.com/v2.3/me/accounts?access_token={access_token}';
  $ch=curl_init();
  CURL_SETOPT($ch,CURLOPT_URL,$url);
  CURL_SETOPT($ch,CURLOPT_RETURNTRANSFER, 1);
  $json=json_decode(curl_exec($ch));
  var_dump($json);
?>
+4

All Articles