假设我是 A。A 向 B 发送邀请。当 B 接受我的好友请求时,我会在我的页面上获取请求 ID,但是如何在我的 php 页面上获取 Mine(A) 的 UID?
请帮我。我为此奋斗了 6 小时。
我正在使用这些(见下文)代码来获取 request_Id。但是从这些我怎样才能获得发件人 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";}
}
?>`