Hasnain Aali
Hasnain Aali

Reputation: 87

how to use fql query

i am new at facebook application development i want to know how fql query works i used it in my application but i want to know where fql query results are displayed or how they can be displayed if you can't explain plz send me the link because the official documentation didn't helped me either.

Upvotes: 0

Views: 2755

Answers (2)

Segers-Ian
Segers-Ian

Reputation: 1057

You can use the Facebook Graph Explorer https://developers.facebook.com/tools/explorer And select under the Access token field, "FQL query". Now you can try FQL queries and see the result of them.

Upvotes: 0

Desmond Liang
Desmond Liang

Reputation: 2310

  1. Connect to FB using the PHP SDK. (available here)
ini_set('display_errors',1);
error_reporting(E_ALL);
require_once 'library/facebook/src/facebook.php';
  1. Check if the user has logged in to FB
$facebook = new Facebook(array(
'appId'  => 'YOUR API ID',    
'secret' => 'YOUR APP SECRET',   
'cookie' => true, // enable optional cookie support
));
  1. FQL

    try {
          $me = $facebook->api('/me');
    
          $currentPage=1;
          $currentPost=1;
          $currentDate="";
    
          $list="";
          $arrDate=array();
    
          $fql    =   "YOUR FQL STATEMENT HERE";
          $param  =   array(
             'method'    => 'fql.query',
             'query'     => $fql,
             'callback'  => ''
          );
          $fqlResult   =   $facebook->api($param);//Here you have your FQL result set
    
          foreach($fqlResult as $row){
          //Do something to the result
    
          }
    
        } catch (FacebookApiException $e) {
          error_log($e);
        }
    

Upvotes: 2

Related Questions