0

我想发布给所有的人通过应用程序连接 发布他所有的朋友在墙上,这个代码只发布它的墙 需要更改或添加到它的内容将带到他的朋友列表中,并通过应用程序将他们发布在墙上

请帮我

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

1 回答 1

0

这是您获取所有朋友用户 ID 的方式:

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

但是,如果您尝试向所有朋友发布信息,Facebook 将阻止您的应用程序。你可以做的是向你的朋友发送Requests

于 2012-08-13T01:56:34.333 回答