Using the Facebook API, how can I get the content of the page?

For example, here is the "page":

http://www.facebook.com/facebook

There is an RSS feed on this page (which I would like to use, ideally), but a) these are browser nuances meaning that I need to fake the user-agent from the script to extract it - and this is really fragile b) the quality of the returned data really bad.

Can I use api chart to get the same data? This url is:

https://graph.facebook.com/facebook/feed

implies that I can, and json is suitable for me, although I am extracting this from a PHP script, not the client side. However, when I try to use this URL for my actual page, I get the following:

{
    "error": {
        "type": "OAuthAccessTokenException",
        "message": "An access token is required to request this resource."
    }
}

, , "" - - ? , - , script .

+5
2

URL CURL, PHP.

$curlResponse = http('https://graph.facebook.com/facebook/feed');
$facebookFeed = json_decode($curlResponse['data'], true);

var_dump($facebookFeed);

php-:

function http($url) {
  $timeout = 30;
  $connectTimeout = 30;
  $sslVerifyPeer = false;

  $response = array();
  $ci       = curl_init();

  /* Curl settings */
  curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $connectTimeout);
  curl_setopt($ci, CURLOPT_TIMEOUT, $timeout);
  curl_setopt($ci, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
  curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $sslVerifyPeer);    
  curl_setopt($ci, CURLOPT_URL, $url);

  $response['http_code'] = curl_getinfo($ci, CURLINFO_HTTP_CODE);
  $response['api_call']  = $url;
  $response['data']      = curl_exec($ci);

  curl_close ($ci);

  return $response;
}
+5
+2

All Articles