duanou9739 2011-07-14 11:35
浏览 61

Facebook图形api朋友邀请

I have managed to send and retrieve data from facebook for invitatin using

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);

But i want to use single user app request , as per docs i need to use TO: filed but this doesnt work, request is sent as well i get invitation id but php code used above returns false. Am i missing something

  • 写回答

2条回答 默认 最新

  • dongyaobo9081 2011-07-15 05:58
    关注

    This works for me:

    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
            });
    

    Moreover you are doing it wrong on PHP side, you would need to redirect the user to a URL where the invitation friend selector would be displayed. There is no way in my knowledge to directly send an invitation to users using PHP.

    评论

报告相同问题?

悬赏问题

  • ¥15 依据报错在原代吗格式的基础上解决问题
  • ¥15 在虚拟机中安装flash code
  • ¥15 单片机stm32f10x编写光敏电阻调节3.3伏大功率灯亮度(光强越大灯越暗,白天正常光强灯不亮,使用ADC,PWM等模块)望各位找一下错误或者提供一个可实现功能的代码
  • ¥20 verilog状态机方法流水灯
  • ¥15 pandas代码实现不了意图
  • ¥15 GD32H7 从存储器到外设SPI传输数据无法重复启用DMA
  • ¥25 LT码在高斯信道下的误码率仿真
  • ¥45 渲染完成之后将物体的材质贴图改变,自动化进行这个操作
  • ¥15 yolov5目标检测并显示目标出现的时间或视频帧
  • ¥15 电视版的优酷可以设置电影连续播放吗?