我在我编写的应用程序中有类似的代码(在Upload video to facebook with php-sdk graph api中找到),但昨天我开始收到OAuthException错误。我找了一个简单的视频上传示例到Facebook页面进行测试,它返回相同的200 OAuthException。我已尝试修改权限以包含video_upload
建议有人吗?
我刚检查过,下面的例子来自Facebook关于如何上传视频的页面。这是行不通的。
`
$app_id = "";// SET TO APP ID
$app_secret = "";// SET TO APP SECRET
$my_url = "";// SET TO URL
$video_title = "TITLE FOR THE VIDEO";
$video_desc = "DESCRIPTION FOR THE VIDEO";
$page_id = " "; // Set this to your APP_ID for Applications
$code = $_REQUEST["code"];
echo '<html><body>';
if(empty($code)) {
// Get permission from the user to publish to their page.
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url)
. "&scope=publish_stream,manage_pages";
echo('<script>top.location.href="' . $dialog_url . '";</script>');
} else {
// Get access token for the user, so we can GET /me/accounts
$token_url = "https://graph.facebook.com/oauth/access_token?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url)
. "&client_secret=" . $app_secret
. "&code=" . $code;
$access_token = file_get_contents($token_url);
$accounts_url = "https://graph.facebook.com/me/accounts?" . $access_token;
$response = file_get_contents($accounts_url);
// Parse the return value and get the array of accounts we have
// access to. This is returned in the data[] array.
$resp_obj = json_decode($response,true);
$accounts = $resp_obj['data'];
// Find the access token for the page to which we want to post the video.
foreach($accounts as $account) {
if($account['id'] == $page_id) {
$access_token = $account['access_token'];
break;
}
}
// Using the page access token from above, create the POST action
// that our form will use to upload the video.
$post_url = "https://graph-video.facebook.com/" . $page_id . "/videos?"
. "title=" . $video_title. "&description=" . $video_desc
. "&access_token=". $access_token;
// Create a simple form
echo '<form enctype="multipart/form-data" action=" '.$post_url.' "
method="POST">';
echo 'Please choose a file:';
echo '<input name="file" type="file">';
echo '<input type="submit" value="Upload" />';
echo '</form>';
}
echo '</body></html>';
?>`
我一直收到这个错误: { “错误”:{ “message”:“(#200)应用程序无权发布到目标”, “type”:“OAuthException”, “代码”:200 } }
答案 0 :(得分:1)
这似乎是Facebook视频上传代码中的一个错误。 Link to Face book Support Request感谢您Deepak Gangore的输入并向Facebook注册了该错误。
答案 1 :(得分:1)
只想分享好消息。这个bug现在已经解决了。