PHP Facebook FQL:在新的SDK中进行查询 [英] PHP Facebook FQL: Making queries in the new SDK

查看:156
本文介绍了PHP Facebook FQL:在新的SDK中进行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



似乎在旧的API中,您可以创建一个Facebook对象并传递一个标准查询(在空白处选择blah x = y ...)但现在我看不到如何做到这一点。 Facebook文档中的所有示例都为graph.facebook.com/?fql等使用了一个get_file_contents。我一直在尝试使用它,但对复杂查询来说似乎效率不高。



帮助?我有点困惑,不明白某些Facebook文档。



谢谢。

解决方案

使用PHP SDK,您可以通过以下方式运行fql查询:

  $ facebook = new Facebook (
'appId'=>'YOUR_API_KEY',
'secret'=>'YOUR_API_SECRET',
'cookie'=> true,
));

$ fql =您的查询;

$ response = $ facebook-> api(array(
'method'=>'fql.query',
'query'=> $ fql,
));

print_r($ response);

我也看过这样做:

$ param = array(
'method'=>'fql.query',
'access_token'=> $ cookie ['access_token'],
'query'=> $ fql,
'callback'=>''
);
$ response = $ facebook-> api($ param);
print_r($ response);

希望这有帮助:)


New to PHP and Graph API.

It seems that in the old API you could create a facebook object and pass in a standard query (select blah in blank where x = y ...) but now I don't see how to do that. All of the examples in the facebook documentation have you using a get_file_contents for graph.facebook.com/?fql etc. I've been trying to use that but it seems inefficient for complex queries.

Help? I'm kinda confused and don't understand some of the facebook documentation.

Thanks.

解决方案

Using the PHP SDK you can run fql queries by :

$facebook = new Facebook(array(
       'appId'  => 'YOUR_API_KEY',
       'secret' => 'YOUR_API_SECRET',
       'cookie' => true,
));

 $fql = "Your query";

 $response = $facebook->api(array(
     'method' => 'fql.query',
     'query' =>$fql,
 ));

 print_r($response);

I’ve also seen it done this way as well:

$param  =   array(
      'method'    => 'fql.query',
      'access_token' => $cookie['access_token'],
      'query'     => $fql,
      'callback'  => ''
);
$response   =   $facebook->api($param);
print_r($response);

Hope this helps :)

这篇关于PHP Facebook FQL:在新的SDK中进行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆