【问题标题】:An error in my code to upload photos {"error":{"message":"(#240) The target_id references an inactive user","type":"OAuthException","code":240}}我上传照片的代码出错 {"error":{"message":"(#240) The target_id references an inactive user","type":"OAuthException","code":240}}
【发布时间】:2012-04-18 20:53:11
【问题描述】:

请帮忙。将照片上传到相册的代码。改代码后不起作用,报错 {"error": {"message": "(# 240) The references target_id an inactive user", "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>';
}

【问题讨论】:

    标签: facebook


    【解决方案1】:

    您确定当前用户已授权(安装)该应用程序吗?

    此外,此错误报告:Photo upload via PHP SDK OpenGraph 是搜索“引用 target_id 为非活动用户”的首批结果之一。

    我不是 php 专家,但这似乎不是 POST 图像的正确方法,也许您应该使用该错误报告中代码中显示的方法。

    【讨论】:

    • 感谢您的回答。代码,但它工作,但 facebook 做了一些改变。然后停止应用程序工作。
    猜你喜欢
    • 2012-09-12
    • 2012-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多