0
我想要獲取所有狀態更新並將其顯示在我的應用程序中。我有存儲在數據庫中的OAuth令牌。FQL - 「訪問令牌需要使用此資源。」
此代碼檢索從數據庫中的access_token,並構造一個URL上面的代碼運行之後查詢
include ('fbconfig.php');
include ('inc/facebook.php');
// make new facebook object
$facebook = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET,
'cookie' => true
));
$username = $_SESSION['username'];
// get the access token from database
$sql = "SELECT fb_token FROM users";
$query = mysqli_query($db_conx,$sql);
$row = mysqli_fetch_array($query);
$access_token = $row[0];
// fql query to get fb status updates
$fql = "SELECT uid,time,message FROM status WHERE uid = me()";
// construct query url
$fql_query_url = "https://graph.facebook.com"
. "/fql?q=" . urlencode($fql)
. '&' . $access_token;
echo $fql_query_url;
,它輸出此URL:
https://graph.facebook.com/fql?q=SELECT+uid%2Ctime%2Cmessage+FROM+status+WHERE+uid+%3D+me%28%29&293721510781740|
這引發錯誤時我點擊鏈接(即使它說我在url中有一個access_token):
{"error":{"message":"An access token is required to request this resource.","type":"OAuthException","code":104}}
我一直在這個小時做了不同的變化,我不明白爲什麼它不檢索我的狀態。
謝謝:)我會接受它時,它讓我。 – jsmos