如何检索用户id后邀请他们到我的facebook应用程序


how to retrive the users ids after inviting them to my facebook application?

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

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'];}
相关文章: