Facebook Open Graph - 查看用户是否在某个时间签到过某个特定地点

发布于 2024-11-09 19:34:54 字数 484 浏览 0 评论 0 原文

有没有办法检查用户是否在过去的任何时间签入过特定地点?

使用 php sdk,我可以获得如下地点信息:

$place = $facebook->api('/placeIDhere');
var_dump($place['checkins'])

这给了我签入计数。

要获取用户最近的签到,我可以这样做

$usercheckins = $facebook->api('/search?type=checkin');
var_dump($usercheckins[0]['place']['name']);

,这可以按名称提供最后一次签到

,但是有没有办法检查用户是否签到了特殊的地方? /search?type=checkin 仅向我提供极少数最近的签入,如果签入时间超过约 2-3 周,它甚至不会出现。

感谢您的帮助。

is there a way to check if a user checked into a particular place at any time in the past?

with php sdk, i can get a place info like:

$place = $facebook->api('/placeIDhere');
var_dump($place['checkins'])

this gives me the checkin count.

to get the recent checkins of a user i could do

$usercheckins = $facebook->api('/search?type=checkin');
var_dump($usercheckins[0]['place']['name']);

this gives me the last checkin by name

but is there a way to check if a user checked into a special place? /search?type=checkin only gives me a very small number of recent checkins and if a checkin is older than ~2-3 weeks it doesn't even appear.

thanks for all help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懵少女 2024-11-16 19:34:54

以下是如何使 bkaid 答案与 PHP SDK 一起使用(参见 github)。

首先,您必须检查用户是否已登录:

require "facebook.php";
$facebook = new Facebook(array(
    'appId'  => YOUR_APP_ID,
    'secret' => YOUR_APP_SECRET,
));

$user = $facebook->getUser();

if ($user) {
    try {
        $user_profile = $facebook->api('/me');
    } catch (FacebookApiException $e) {
        $user = null;
    }
}

如果没有登录,则呈现链接以使他登录。如果是,您可以进行 API 调用:

if (!$user) {
    echo '<a href="' . $facebook->getLoginUrl() . '">Login with Facebook</a>';
} else {
    $fql = "SELECT post_id, message FROM checkin
            WHERE author_uid = me() AND page_id = THE_PAGE_ID";

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

希望有帮助!

Here is how to make the bkaid answer worked with the PHP SDK (see on github).

First, you have to check if the user is logged in or not :

require "facebook.php";
$facebook = new Facebook(array(
    'appId'  => YOUR_APP_ID,
    'secret' => YOUR_APP_SECRET,
));

$user = $facebook->getUser();

if ($user) {
    try {
        $user_profile = $facebook->api('/me');
    } catch (FacebookApiException $e) {
        $user = null;
    }
}

You render the link to make him log in if he is not. And if he is, you can make the API call :

if (!$user) {
    echo '<a href="' . $facebook->getLoginUrl() . '">Login with Facebook</a>';
} else {
    $fql = "SELECT post_id, message FROM checkin
            WHERE author_uid = me() AND page_id = THE_PAGE_ID";

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

Hope that helps !

千纸鹤带着心事 2024-11-16 19:34:54

针对 FQL 查询 /developers.facebook.com/docs/reference/fql/checkin/" rel="nofollow">签入 表。像这样的东西:

    SELECT coords,tagged_uids,author_uid,page_id,app_id,post_id,timestamp,message 
    FROM checkin 
    WHERE author_uid = me() and page_id = 'placeID'

Do a FQL query against the checkin table. Something like:

    SELECT coords,tagged_uids,author_uid,page_id,app_id,post_id,timestamp,message 
    FROM checkin 
    WHERE author_uid = me() and page_id = 'placeID'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文