mardi 31 mars 2015

How can I fetch data from facebook events using graph API

I want to fetch data from a facebook event using graph API. I wrote the following code :



<?php
$url = 'http://ift.tt/1EN8azF';
$contents = file_get_contents( $url );
if( $contents )
{
$data = json_decode( $contents, true );
echo '<pre>';
print_r( $data );
echo '</pre>';
}
?>


My event page address URL is http://ift.tt/1EN8aPT. The above code is not working properly. When I am using the same code for a page,e.g., http://ift.tt/1DTdKmp , it works fine.



<?php
$url = 'http://ift.tt/1DTdLqk';
$contents = file_get_contents( $url );
if( $contents )
{
$data = json_decode( $contents, true );
echo '<pre>';
print_r( $data );
echo '</pre>';
}
?>


Also, I am unable to run it on localhost. Please help me to solve this or please tell me any other method to solve this.


Aucun commentaire:

Enregistrer un commentaire