说我是A.并且A向B发送邀请。当B,接受我的朋友请求,然后我在我的页面上提出请求ID但是我如何在我的php页面上获得我的A UID(A)?
请帮帮我。自6小时以来我一直在努力。
我正在使用这些(见下文)代码获取request_Id。但是从这些我怎样才能获得SENDERS ID?
<?php
require_once('phps/fbsdk/src/facebook.php');
$config = array
(
'appId' => '27c3932323897****82',
'secret' => '******************************',
);
$facebook = new Facebook($config);
//get the request ids from the query parameter
$request_ids = explode(',', $_REQUEST['request_ids']);
//build the full_request_id from request_id and user_id
function build_full_request_id($request_id, $user_id) {
return $request_id . '_' . $user_id;
}
//for each request_id, build the full_request_id and delete request
foreach ($request_ids as $request_id)
{
echo ("reqeust_id=".$request_id."<br>");
$full_request_id = build_full_request_id($request_id, $user_id);
echo ("full_request_id=".$full_request_id."<br>");
try {
$delete_success = $facebook->api("/$full_request_id",'DELETE');
if ($delete_success) {
echo "Successfully deleted " . $full_request_id;}
else {
echo "Delete failed".$full_request_id;}
}
catch (FacebookApiException $e) {
echo "error";}
}
?>`
答案 0 :(得分:3)
使用您获得的请求ID拨打图表api(graph.facebook.com/{REQUEST_ID}),您将收到发件人ID,您将获得以下内容:
{
"id": "493703870648580",
"application": {
"name": "Send Requests How To",
"id": "403223126407920"
},
"to": {
"name": "Chris Abe Colm",
"id": "100003086810435"
},
"from": {
"name": "Christine Abernathy",
"id": "1424840234"
},
"data": "{\"badge_of_awesomeness\":\"1\",\"social_karma\":\"5\"}",
"message": "Learn how to make your Android apps social",
"created_time": "2012-10-07T17:29:57+0000"
}
有关图表api的更多信息:http://developers.facebook.com/docs/reference/api/
PS:从您的示例中移除您的应用秘密