Facebook api video.upload requires HTTPS connection
I noticed a very funny error message Facebook API returns when I tried to use CURL to upload video to Facebook as below:
This method requires an HTTPS connection
Based on facebook api doc: developers.facebook.com/docs/ref … deo.upload it wrote that:
Video uploads to Facebook happen on a specific set of servers. When you call video.upload, you need to account for this fact. You must make the video.upload call to http://api-video.facebook.com, and not api.facebook.com. If you call api.faceb开发者_运维问答ook.com, an error gets returned.
Curiously, I tried to change the protocol from HTTP to HTTPS then I got a different error message. This time. it is telling me that the host does not exist.
Could anyone please help?
Here is my php code
Code:
$args = array( 'method' => 'video.upload', 'title' => 'my video', 'description' => 'Test my video upload via API', 'access_token'=> $facebook->getAccessToken(), 'api_key'=>$fbconfig['api'] );
$args["kdVBRO1IU.flv"] = '@'.SITE_PATH.'temp/kdVBRO1IU.flv'; //echo $args["AtXAI8Pdt.flv"];
//$statusUpdate = $facebook->api($args);
$ch = curl_init();
$url = 'http://api-video.facebook.com/restserver.php';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
Thanks for your input BeRecursive, It took me awhile to get it working The URl I used is
http://api-video.facebook.com/facebook.upload.video
Quite strange as I could not find a single document mention about this URL, however, following one of the post on facebook developer forum then I got it.
精彩评论