如何发送Facebook应用程序请求以接收数据? [英] How to send a Facebook application request to retrieve data on accepting?

查看:96
本文介绍了如何发送Facebook应用程序请求以接收数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要发送一个Facebook应用程序的请求,以便当用户接受请求时,我需要检索发送人的姓名和接受该用户的人的姓名。有人可以分享codr的例子

Need to send a request for a Facebook application so that when the user accepts the request I need to retrieve the name of the person who sent it and the name of the person who accepted it. Can someone please share examples of the codr

推荐答案

发送邀请时可以添加任何数据进行跟踪,让我们说发送 sender_name ,所以您的发送请求功能将如下所示:

while sending invite you can add any data to track, let say you want to send sender_name so your send request function will be like:

FB.ui({
        method: 'apprequests',
        message: "has invited you to the app",
        filters:['app_non_users'],
        data: sender_name
    }, function (response) {
    });

当接收者到达您的应用程序时,单击发送的请求通知,然后您可以检索数据并删除php中的请求如下:

and when the receiver comes to your application clicking the request notification sent, then you can retrieve data and delete the request in php as below:

if(isset($_GET['request_ids']))
   {
       $request_ids = $_GET['request_ids'];
       $request_ids = explode(",", $request_ids);
       foreach($request_ids as $request_id)
            {
                 $request_object = $facebook->api($request_id);
                 if(isset($request_object['data'])) $req_data = $request_object['data'];//you can now use the sent $req_data your way
                 $full_request_id = $request_id."_".$current_user_fbid;
                 $facebook->api("$full_request_id","DELETE");
            }
   }

这篇关于如何发送Facebook应用程序请求以接收数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆