Reputation: 185
I've been uploading video to the Facebook open graph API using the following code. Something seems to have changed, as the API is now returning NULL every single time. I can't see what I'm doing wrong; can someone help?
(Note: $local_filename below verifiably exists, and is a video. CURL is also working, as we use it to connect to other services.)
$facebook = new Facebook(array(
'appId' => $config->facebook_appid,
'secret' => $config->facebook_secret,
'cookie' => true,
'fileUpload' => true,
));
try {
$facebook->setAccessToken($user->facebook_token);
$fbvideo = $facebook->api('/me/videos','POST',
array(
'source' => '@' . $local_filename,
'title' => 'Some title',
'description' => 'Some description',
'message' => 'Uploaded with ...'));
} catch (FacebookApiException $e) {
//...
}
Upvotes: 0
Views: 675
Reputation: 6484
you have to post to different url that is https://graph-video.facebook.com/ not https://graph.facebook.com/
don't know how and if that map on $facebook->api, but you can post by using Graph API
there is an article and sample code here somewhere https://developers.facebook.com/blog/archive#2011
Upvotes: 0
Reputation: 61
Have you tried to catch the exception or print the result?
try {
$facebook->setAccessToken($user->facebook_token);
$fbvideo = $facebook->api('/me/videos','POST',
array(
'source' => '@' . $local_filename,
'title' => 'Some title',
'description' => 'Some description',
'message' => 'Uploaded with ...'));
} catch (FacebookApiException $e) {
$res = $e->getResult();
}
print_r($fbvideo);
print_r($res);
Upvotes: 1