嗨,我像这样发送我的请求
<?php
$app_id = "127736900693315";
$canvas_page = "http://apps.facebook.com/greetingz";
$message = "Dynamic_msg";
$data_s="Dynamic_data";
$requests_url = "https://www.facebook.com/dialog/apprequests?app_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page)
. "&message=" . $message."&data=".$data_s;
if (empty($_REQUEST["request_ids"])) {
echo("<script> top.location.href='" . $requests_url . "'</script>");
} else {
}
?>
此请求正常,但是当接收者单击通知时,我通过 request_ids 获取代码如下
if(!empty($_REQUEST['request_ids'])) {
$config = array(
'appId' => '343704039016593',
'secret' => '56e711bf93d4e46426aa662c8be8d5ef',
'cookie' => true,
);
$facebook = new Facebook($config);
echo $user_id= $facebook->getUser(); //** 0 printing**
$app_token = $facebook->getAccessToken();
$requests = explode(',',$_REQUEST['request_ids']);
foreach($requests as $request_id) {
$request_content = json_decode(file_get_contents("https://graph.facebook.com/'".$request_id."_".$user_id."'?access_token=$app_token"), TRUE);
print_r($request_content); //**nothing is printing**
$deleted = file_get_contents("https://graph.facebook.com/$request_id?access_token=$app_token&method=delete");
}
我在尝试近 7 天的编码时不知道有什么问题,我在网上查看了大部分教程,其中大部分都是旧的,现在 API 已经更新。我什至无法获取 user_id ......我需要发送我的请求 OAuth Dialog 吗?}