webhost

Web hosting

Friday, March 23, 2012

Facebook FQL query using graph api

we can run facebook FQL  query using the graph api.
Here example to get facebook photos from facebook album
First we need to include the facebook class then create an object of facebook class
by using a simple example of FQL query we get an array of details of photos of particular album

require '../src/facebook.php';

 $facebook = new Facebook(array(
  
'appId'  => '...',
  
'secret' => '...'));

function get_photos_by_album_id($album_id){

if(
$album_id)
        
$fql            =   'SELECT pid,src_big,owner,link,position,created,caption,src FROM photo WHERE aid="'.$album_id.'"';
           
                
$param  =   array(
                
'method'    => 'fql.query',
                
'query'     => $fql,
                
'callback'  => ''
            
);
            
$fqlResult   =   $facebook->api($param);
    return 
$fqlResult;

}

No comments:

Post a Comment