本文介绍了如何张贴到所有的朋友在墙上一次Facebook的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要发布给所有的人通过应用程序连接发布他所有的朋友在墙上,这code仅公布其壁上有什么需要改变或添加,将采取他的好友列表,并会在它们发布通过应用墙

请帮我

 规定../settings.php
    需要'../src/facebook.php';
    要求../fbaccess.php
    要求web_config.php
    //用户从数据库中的数据
    $ SQL =的mysql_query(SELECT USER_ID,user_access_token,user_access_token_expire FROM data_table);    而($数据= mysql_fetch_array($ SQL)){
    $ USER_ID = $数据['USER_ID'];
    $的accessToken = $数据['user_access_token'];
    $ accessTokenExpire = $数据['user_access_token_expire'];
    尝试{
                $ publishStream = $ facebook-> API(/ $ USER_ID /饲料,后,阵列(
                    '消息'= GT; ,
                    '链接'=> '',
                    '图片'=> '',
                    '名'=>的iOS应用和放大器;游戏',
                    '描述'=> ''
                    )
                );
                //为$ _GET ['发布']被设定为通过重定向用户的基本URL中移除
            }赶上(FacebookApiException $ E){
                error_log中($ E);
            }
    }


解决方案

这是你如何让你的朋友的用户ID:

  SELECT UID FROM用户WHERE(UID IN(SELECT UID2从相知WHERE UID1 =我()))

不过,如果你试图张贴到所有的朋友,Facebook将阻止应用程序。你可以做的,而不是为您的朋友发送的要求

I want to publish to all people to connect through application Publish all his friends in the wall, this code only publishes its wall What needs to change or add to it will take to his friends list and will publish them in the wall through app

please help me

    require "../settings.php";
    require '../src/facebook.php';
    require "../fbaccess.php";
    require "web_config.php";


    //user data from database
    $sql = mysql_query("SELECT user_id,user_access_token,user_access_token_expire FROM data_table");

    while ($data = mysql_fetch_array($sql)){
    $user_id = $data['user_id'];
    $accessToken = $data['user_access_token'];
    $accessTokenExpire = $data['user_access_token_expire'];


    try {
                $publishStream = $facebook->api("/$user_id/feed", 'post', array(
                    'message' => "",
                    'link'    => '',
                    'picture' => '',
                    'name'    => 'iOS Apps & Games',
                    'description'=> ''
                    )
                );
                //as $_GET['publish'] is set so remove it by redirecting user to the base url
            } catch (FacebookApiException $e) {
                error_log($e);
            }
    }
解决方案

This is how you get all of your friends user ids:

SELECT uid FROM user WHERE (uid IN (SELECT uid2 FROM friend WHERE uid1=me()))

However, if you try posting to all your friends, Facebook will block your application. What you can do instead is send your friends Requests.

这篇关于如何张贴到所有的朋友在墙上一次Facebook的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 04:17