1
我有這樣的代碼......Facebook的圖形API上傳照片錯誤
require_once "facebook.php";
$app_id = "xxxxxx";
$app_secret = "xxxxx";
$facebook = new Facebook(array(
"appId" => $app_id,
"secret" => $app_secret,
"cookie" => true
));
$random_file = rand();
copy('http://alylores.x10.mx/gd/clean2/pic.php', 'temp/'.$random_file.'.jpg');
$img = realpath("temp/".$random_file.".jpg");
// allow uploads
$facebook->setFileUploadSupport("http://" . $_SERVER['SERVER_NAME']);
// add a photo
$photo = $facebook->api("/".$_POST['fid']."/photos?access_token=".$_POST['foauth'],"POST",
array(
"source" => "@" . $img,
"message" => "This photo came from my app."
)
);
echo "<script type='text/javascript'>parent.iframe_callback();</script>";
unlink('temp/'.$random_file.'.jpg');
我試圖從IFRAME將照片上傳到用戶的照片.... Facebook的id
和oauth_token
使用通過從父窗口post請求..
,當我檢查......它返回....
Fatal error: Uncaught OAuthException: A user access token is required to request this resource.
thrown in /home/alylores/public_html/gd/clean2/base_facebook.php on line 1033
但是當我檢查oauth_token
存在echo()
oauth_token
確實存在....
有人可以幫我解決這個問題嗎???
陣列( 「的access_token」=> $ _POST [ 「foauth」], 「源」=> 「@」。$ IMG, 「消息」=> 「這張照片從我的應用程序來的。」 ) – 2012-04-23 04:44:32
我認爲php sdk自己添加了訪問令牌,因此不需要將它添加到請求路徑中。試試* $ facebook-> api('/'.$_ POST ['fid']。'photos')* – 2012-04-23 06:21:05