请求对话框 - 如何获取发件人ID

时间:2011-10-21 09:44:07

标签: facebook

我正在使用下面这段代码,这样当我的朋友接受我的邀请时,我会得到hte请求ID,但我如何得到我的uid。

说我是A.A发送邀请给b。当b,接受,我可以得到请求ID但我怎么得到A UID

 //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";}
 }

2 个答案:

答案 0 :(得分:1)

当您向/{request_id}拨打GET电话时,您会收到发件人和收件人的姓名

答案 1 :(得分:0)

尝试$user_id = $facebook->getUser();

编辑:回头查看你的代码,我发现你已经使用了$ user_id,那么这不是你需要的ID吗?