是否可以将新的图形 API FQL 扩展与 PHP SDK 一起使用?
Facebook 宣布可以通过 Graph API 使用 FQL:https://developers.facebook.com/blog /post/579/
这非常好,但我想通过 PHP SDK 使用它,因为我的所有应用程序都使用它,并且所有授权都通过该库。我有最新的 Git 版本的 SDK,但是这个:
$facebook->api('/fql?q=SELECT+uid2+FROM+friend+WHERE+uid1=me()');
...或类似的查询不起作用。它返回空数组或冻结我的 Apache(!)。库内部发生了什么魔力,使得如此简单的选择或其结果无法通过?
编辑:我知道我可以在 PHP SDK 中使用 REST API 支持 你提到。我对使用新方法感到好奇,因为 REST API 已被弃用,并且很可能在几个月内它将不再存在。我的策略是使用 Facebook 发布的最新可用功能。这样做我就不需要因为使用已弃用的功能而时不时地更新我的代码。
编辑2:好吧,我希望我的房间里没有LSD...但是,今天我打开浏览器,其中包含我之前尝试使用上述不同方法的所有尝试,你猜怎么着...?有用!现在我可以准确地使用我写的更高几行的那段代码,它完美地返回了预期的结果......而不是 WTF,我说:Facebook Platform。
Facebook announced possibility to use FQL via Graph API: https://developers.facebook.com/blog/post/579/
That is very nice, but I'd like to use it via PHP SDK as all my application uses it and all authorization goes through that library. I have the newest Git version of SDK, but this:
$facebook->api('/fql?q=SELECT+uid2+FROM+friend+WHERE+uid1=me()');
...or similar queries just don't work. It returns empty array(s) or freezes my Apache (!). What magic happens inside of the library that such an easy select or it's results can't pass through?
EDIT: I know I can use REST API support in PHP SDK as you mention. I was curious about using the new method, because REST API is deprecated and very likely it won't exist any more in a couple of months. My policy is to use the latest available features Facebook released. Doing so I won't need to update my code every now and then because of using deprecated features.
EDIT 2: Well, I hope there is no LSD in my room... however, today I opened my browser with all my previous attempts to use different approaches mentioned above and guess what...? It works! Now I can use exactly that piece of code I wrote a few lines higher and it perfectly returns what is expected... Instead of WTF, I say: Facebook Platform.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确实可以通过
api
方法使用FQL
。试试这个:
正如您所看到的,您必须指定您正在运行 FQL 查询,然后将 FQL 语句传递到数组中。
编辑:
在 PHP SDK 中,您必须使用
fql.query
方法,SDK 中没有其他方法执行 FQL 查询(目前)。You can indeed use
FQL
through theapi
method.try this:
As you can see you must specify that you are running an FQL query, and then pass the FQL statement into the array.
EDIT:
Inside the PHP SDK, you must use the
fql.query
method, there is no other way of executing an FQL query within the SDK (Yet).