【问题标题】:facebook api and fql qry post to all my friendsfacebook api 和 fql qry 发布给我所有的朋友
【发布时间】:2012-08-10 05:33:24
【问题描述】:

我想通过应用发布我所有的朋友

当我输入这段代码时,它给我带来了一个错误

解析错误:语法错误,意外的 T_STRING,在第 19 行的 test111.php 中需要 ')'

谁能帮助我? 谢谢

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

【问题讨论】:

    标签: facebook api facebook-fql


    【解决方案1】:

    您需要在以$all_friends= 开头的行末尾再添加一个)

    这里还有其他几个问题。试试这样的 PHP 语法检查器:http://www.piliapp.com/php-syntax-check/

    【讨论】:

    • $all_friends = $facebook->api(array('method' => 'fql.query', 'query' => 'SELECT uid FROM user WHERE (uid IN (SELECT uid2 FROM friend WHERE uid1=me()))); 添加更多 ) 仍然有问题
    • 语法检查器链接在我的回答中。用它。您在此处发布的代码中还有几个语法错误,您发布的代码的第 19 行不会产生该错误。
    • 我已经发布了整个代码 我应该对代码进行什么更改才能工作
    • 您应该改变的是您对基本 PHP 语法的了解——将其从“几乎不存在”改为至少“可以自己编写一个 'hello world' 脚本”,然后再继续尝试使用 FB API。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多