I'm facing some issues with PHP Facebook SDK and the upload of a video to a Facebook page.
I explain you: the video is uploaded correctly, but I want to insert it in a specific Facebook album. I think that the problem and also the solution is in these lines.
Moreover, the video is always uploaded in the Page Photos section and not in the Videos section.
How do I upload the video to a specific album or in the Videos section?
Thanks in advance for your help!
$response = (new FacebookRequest(
$session, 'POST', '/{PAGE-ID}/videos', array(
'source' => new CURLFile($pathtofile.$name, 'video/mp4'),
'title' => basename($name, ".mp4")
EDIT
I edited my code in this way, using the cURL library, but the problem is still the same: the video is uploaded into the Photo section.
Is there a way to upload it into the Video album?
$attachment = array(
'access_token'=> 'access_token',
'title' => 'Video Title',
'source'=> new CURLFile("$pathtofile", 'video/mp4'));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph-video.facebook.com/v2.2/pageid/videos');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output
$result = curl_exec($ch);
print_r($result);
curl_close ($ch);