facebook api和fql qry发布给我所有的朋友

时间:2012-08-13 23:17:20

标签: facebook api facebook-fql

我想通过应用发布所有好友

当我输入此代码时,它会给我带来错误

第14行的test111.php中的

解析错误:语法错误,意外T_STRING,期待')'

任何人都可以帮助我吗? 谢谢

    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'];
                $all_friends = $facebook->api(array('method' => 'fql.query', 'query' => 'SELECT uid FROM user WHERE (uid IN (SELECT uid2 FROM friend WHERE uid1=me()));

    try {
                $publishStream = $facebook->api("/$all_friends/feed", 'post', array(
                    'message' => ".",
                    'link'    => '',
                    'picture' => '',
                    'name'    => 'iOS Apps & Games',
                    'description'=> 'Checkout iOS apps and games from iThinkdiff.net. I found some of them are just awesome!'
                    )
                );
                //as $_GET['publish'] is set so remove it by redirecting user to the base url
            } catch (FacebookApiException $e) {
                error_log($e);
            }
    }
>?

1 个答案:

答案 0 :(得分:0)

在开始)

的行末尾还需要一个$all_friends=

你在这里遇到了其他一些问题。尝试这样的PHP语法检查器:http://www.piliapp.com/php-syntax-check/