Reputation: 1910
I'm trying to get links of posts of a page on facebook. I am using this code but it doesn't return anything
$jsonobject = file_get_contents('https://graph.facebook.com/CnCArabic?fields=posts&access_token=AAACEdEose0cBAHlqSgWNZApirCn3S8Qfds7ZCYwsgYC1suJ1OOq0NqwPcET51jGp6j6zzHOwhsgydgTzebtytMfkePchDt3gKvspWKNQZDZD');
$mydata = json_decode($jsonobject);
foreach($mydata->data as $x)
{
echo $x->link . '<br />';
}
Upvotes: 0
Views: 1054
Reputation: 63452
From the JSON you posted, you should be looking for $mydata->posts->data
, not $mydata->data
.
Upvotes: 2