如何邀请他们到我的Facebook应用程序后retrive用户的id?

我使用这个代码来获得邀请的用户到我的应用程序,但它不工作

if (isset($_REQUEST['request_ids'])) { $APPLICATION_ID = "2222222222222222"; $APPLICATION_SECRET = "sfgjjksjlfansnmeasdedxcxcvxdfsda"; $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $APPLICATION_ID . "&client_secret=" . $APPLICATION_SECRET . "&grant_type=client_credentials"; $app_token = file_get_contents($token_url); $requests = explode(',',$_REQUEST['request_ids']); foreach($requests as $request_id) { $request_content = json_decode(file_get_contents("https://graph.facebook.com/" . $request_id . "?" . $app_token), TRUE); $from_id = $request_content['from']['id']; $to_id = $request_content['to']['id']; echo $from_id . " - " . $to_id; } }

我可以请求ID,但我不能检索的用户ID。

$from_id = $request_content['from']['id'];

$request_content['to']['id'];

没有返回值...

--------------解决方案-------------

解:-

第一:

$comma_separated = implode(",", $_REQUEST["request_ids"]);

然后:

$requests = explode(',',$comma_separated);

而且当然:

foreach($requests as $request_id)
{
$request_content = json_decode(file_get_contents("https://graph.facebook.com/" . $request_id . "?" . $app_token), TRUE);
$from_id = $request_content['from']['id'];
$to_id = $request_content['to']['id'];}

分类:php 时间:2015-03-15 人气:0
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 0.440 (s). 10 q(s)