2011-07-14 146 views
0

我已成功地用于发送和检索来自Facebook的数据invitatin使用Facebook的图形API朋友邀请

FB.ui({ 
      method: 'apprequests', 
      to: sendto, 
      message: 'Win Mega Prizes!', 
      title: 'Enter in this contest!' 
     }, 
     function (response) { 
      if (response && response.request_ids) { 
       var requests = response.request_ids.join(','); 
       alert(requests); 
        window.location.href = "http://www.rmyserver/index.php?invitations="+requests+"&contest_id="+c_id+"&page_id="+page_id+"&user="+from+"&g_id="+g_id+"&sendto="+sendto+"&single=1";   

      } else { 
       alert('canceled'); 
      } 

PHP

foreach($requests as $request_id) { 
     // Get the request details using Graph API 
     echo $request_content = json_decode(file_get_contents("https://graph.facebook.com/$request_id?$app_token"), TRUE); 

但我想使用单用户应用的请求,按照文档我需要使用TO:提交,但这不起作用,请求发送以及我得到邀请ID,但上面使用的PHP代码返回false。 我思念的东西

回答

-1

这个工作对我来说:

FB.ui({ 
      method:'apprequests', 
      message:'I want you to open up your heart a little.', 
      to:123456798, 
      // filters:['app_non_users'], // commented: let users send notifications to app users too, probably a good idea to make them revisit? 
      data:'' // send data what you would like to track, FB will send that back in the URL for us 
      // @todo send google campaign parameters 
     }); 

而且你做错了PHP的一面,你需要将用户重定向到哪里会被显示在邀请朋友选择一个URL。据我所知,没有办法直接向使用PHP的用户发送邀请。

+0

window.location.href = “HTTP://www.rmyserver/index.php邀请=” +请求; 我正在重定向用户请求id – Shahid