I'm trying to Post a video onto Facebook using Facebook php SDK and Facebook graph and I get a strange response back.
it shows a success but null video ID!
This is the response I get:
{"video_id":null,"success":true}
And this is my code:
$fb = new Facebook\Facebook([
'app_id' => 'XXX',
'app_secret' => 'XXXXX',
'default_graph_version' => 'v2.9',
]);
$accessToken = 'XXXXXX';
try {
$videoTitle = 'FOO';
$videoDescription = 'BAR';
$data = [
'title' => $videoTitle,
'description' => $videoDescription,
];
$response = $fb->uploadVideo('/me/', '/var/www/vhosts/SITE.co.uk/httpdocs/video.mp4', $data, $accessToken);
} catch(Facebook\Exception\ResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exception\SDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
//echo 'Video ID: ' . $response;
echo json_encode($response);
I don't know whats causing this and I have spent hours trying to figure this out.
any help would be appreciated.