2012-04-18 25 views
1

請幫幫我。用於將照片上傳到相冊的代碼。在更改代碼無效後,報告error {「error」:{「message」:「(#240)引用target_id非活動用戶」,「type」:「OAuthException」,「code」:240}我什麼也沒有想到。我在這裏尋找專業和支持。謝謝你的回答。上傳照片時出現錯誤{「error」:{「message」:「(#240)target_id引用非活動用戶」,「type」:「OAuthException」,「code」:240}}

$app_id = "xxxxx"; 
$app_secret = "xxxxxxx"; 
$post_login_url = "http://redirectpage"; 
$album_id = "1"; 
$photo_url = "http://myimg.com"; 
$photo_caption = "xxxxxxxxx"; 
$code = $_REQUEST["code"]; 
if (!$code){ 
$dialog_url= "http://www.facebook.com/dialog/oauth?"`enter code here` 
    . "client_id=" . $app_id 
    . "&redirect_uri=" . urlencode($post_login_url) 
    . "&scope=publish_stream"; 
echo("<script>top.location.href='" . $dialog_url 
    . "'</script>"); 
} else { 
$token_url="https://graph.facebook.com/oauth/access_token?" 
    . "client_id=" . $app_id 
    . "&client_secret=" . $app_secret 
    . "&redirect_uri=" . urlencode($post_login_url) 
    . "&code=" . $code; 
$response = file_get_contents($token_url); 
$params = null; 
parse_str($response, $params); 
$access_token = $params['access_token']; 


$graph_url= "https://graph.facebook.com/" 
    . $album_id . "/photos?" 
    . "url=" . urlencode($photo_url) 
    . "&message=" . urlencode($photo_caption) 
    . "&method=POST" 
    . "&access_token=" .$access_token; 

echo '<html><body>'; 
echo file_get_contents($graph_url); 
echo '</body></html>'; 
} 

回答

0

您確定當前用戶已授權應用程序(安裝它)嗎?

另外,這個錯誤報告:Photo upload via PHP SDK OpenGraph是gooling的第一個結果「The reference target_id an inactive user」。

我不是一個php專家,但這似乎不是正確的方式發佈圖像,也許你應該使用該錯誤報告中的代碼中顯示的方法。

+0

謝謝你的回答。代碼,但它的工作,但Facebook做了一些改變。然後停止應用程序工作。 – 2012-04-19 17:49:05

相關問題