問題描述
使用 Facebook 提供的 PHP 庫的 2.1.2 版,針對 Graph API 設計我的第一個應用程序.試圖最大限度地提高性能等開箱即用,并希望將幾個調用一起批處理為一個調用,但在文檔中找不到任何內容......我確定我一定遺漏了一些簡單的東西,但我很難過.>
我想將這些調用(只是一個示例)轉換為單個批處理調用:
$me = $facebook->api('/me', $params);$groups = $facebook->api('/me/groups', $params);
Facebook 推薦使用 FQL 為此;http://developers.facebook.com/docs/guides/performance通過在(嵌套)查詢中組合您的請求.
他們自己的例子:
$friends_locations = $facebook->api_client->fql_query('SELECT hometown_location from user where uid in ' .'(SELECT uid2 fromfriend where uid1=' . $user_id . ')');
如果您的請求不相互依賴,您可以使用 fql.multiquery
Designing my first app against the Graph API, using version 2.1.2 of the Facebook supplied PHP library. Trying to maximize performance, etc out of the box and want to batch a few calls together into one call, but can't find anything in the documentation... I am sure I must be missing something simple, but am stumped.
I'd like to turn these calls (just an example) into a single batched call:
$me = $facebook->api('/me', $params);
$groups = $facebook->api('/me/groups', $params);
Facebook recommends using FQL for this; http://developers.facebook.com/docs/guides/performance by combining your requests in a (nested) query.
Their own example:
$friends_locations = $facebook->api_client->fql_query(
'SELECT hometown_location from user where uid in ' .
'(SELECT uid2 from friend where uid1=' . $user_id . ')');
If your requests aren't dependant on eachother you can use fql.multiquery
這篇關于使用 Facebook Graph API & 進行批量調用PHP的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!