我有publish_stream應用程序,我可以在我的用戶牆上發佈狀態更新,現在我要發佈照片,搜索後我讀到batchrequest,使我的代碼,這樣錯誤有照片批量上傳請求+多用戶
<?php
require_once('./includes/config.php');
require_once('./includes/skins.php');
require_once('./includes/functions.php');
require_once('./includes/facebook.php');
$app_id = "$appid";
$app_secret = "$appsec";
$sql=mysql_query("select `f_id`, `facebook_access_token` from `users` ");
while($rows = mysql_fetch_array($sql)){
$f_id=$rows['f_id'];
$facebook_access_token=$rows['facebook_access_token'];
$batched_request = '[{"method":"POST", "relative_url":"'.$f_id.'/photos",'
. ' "body" : "message=لو بتحب جاهين و رباعياته اشترك معانا فى التطبيق و هننشرلك على بروفايلك اجمد رباعيات صلاح جاهين http://2lshmaker.uni.me/jahin/", "attached_files":"file1"}}]';
$post_url = "https://graph.facebook.com/" . "?batch="
. Urlencode($batched_request) . "&". $facebook_access_token
. "&method=post";
}
echo ' <form enctype="multipart/form-data" action="'.$post_url.'"
method="POST">';
echo 'Please choose 2 files:';
echo '<input name="file1" type="file">';
echo '<input type="submit" value="Upload" />';
echo '</form>';
?>
但它給我的錯誤
{
"error": {
"message": "Top level access token or app id not specified for batch request.",
"type": "GraphBatchException"
}
}
我不知道我得到了什麼,儘管已經有publish_stream和有效的access_token
我真的可以理解錯誤中寫的是什麼,問題是什麼是頂級訪問令牌廣告我如何使代碼成功工作 –
@phwd添加了文檔後,仍然無法幫助。我已經閱讀過這些文檔,但是他們沒有提供工作示例,也沒有解釋上述代碼的錯誤。這纔是重點。這些文檔沒有幫助,因爲它們很模糊,沒有提供示例。不是一個有用的答案。 –
請不要提及我,如果你沒有什麼可說的,除非它沒有幫助。這是一條雙向的街道。你必須提供你的問題的細節,以獲得細節。這確實是OP的問題的解決方案,因爲他將PHP中的調用推爲「&」。 $ facebook_access_token',它最喜歡等同於'ADXXXXXXAccessToken'而不是'access_token = ADXXXXXXAccessToken'注意缺少'access_token'部分。所以錯誤確實是正確的,他沒有正確指定它。另外請不要輸入CAPS,這是一個令人討厭的方式來關注正在嘗試幫助的人 – phwd