批调用与Facebook图形API和放大器; PHP [英] Batch calls with Facebook Graph API & PHP

查看:136
本文介绍了批调用与Facebook图形API和放大器; PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的设计对图形API第一个应用程序,使用Facebook的2.1.2版本提供的PHP库。试图最大限度地提高性能等开箱即用,想批量打了几个电话连成一个呼叫,但在文档中找不到任何...我相信我一定是失去了一些东西简单,但我难住了。

我想将这些呼叫(只是一个例子)集成到一个批处理电话:

  $我= $ facebook-> API('/我',$ params)方法;
$组= $ facebook-> API('/ ME /组',$ params)方法;


解决方案

Facebook的建议使用 FQL 本; http://developers.facebook.com/docs/guides/performance
按您的要求在(嵌套)查询相结合。

他们自己的例子:

  $ friends_locations = $ facebook-> api_client-> fql_query(
    选择从用户其中uid在hometown_location。
    (从朋友选择UID2,其中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图形API和放大器; PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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