- file_get_contents: documentation ( source)
- json_decode: documentation ( source)
<?php
$page_id = '189147671108377';
$page_access_token = '488543067934739|nMZH2r92f-6j2amnWaAUIrQZHlg';
$json = file_get_contents('https://graph.facebook.com/'.$page_id.'/posts?access_token='.$page_access_token);
$data = json_decode($json);
/*
There are multiple properties which contain links, pictures, etc. of that particular status
var_dump($data) to see all available properties.
*/
$posts = array();
foreach ($data->data as $post)
{
$posts[] = array(
'messgage' => $post->message,
'picture' => $post->picture,
'link' => $post->link,
'description' => $post->description
);
// get the last 10 statuses
if (count($posts) == 10) break;
else continue;
}