我需要使用php中的API在我的脸书页面上发布视频,但我收到了以下错误:
No permission to publish the video
以下是我的代码:
$fb = new Facebook\Facebook([
'app_id' => '184937xxxxxxxxx',
'app_secret' => '63ba95384b898fxxxxxxxx',
'default_graph_version' => 'v2.10',
]);
$data = [
'title' => 'My Foo Video',
'description' => 'This video is full of foo and bar action.',
'source' => $fb->videoToUpload('test.mp4'),
];
$pageAccessToken ='xxxxxxxxxxxxxxxxxxxxxx';
try {
//825870214256735 is page id
$response = $fb->post('/825870214256735/videos', $data, $pageAccessToken);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
}