开发者

how to use fql query

i am new at facebook application development i want to know how fql query works i used it 开发者_如何学Goin 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.


  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);
        }
    


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜