views:

146

answers:

2

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.facebook.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);
+1  A: 

Try using

https://api.facebook.com/method/video.upload?access_token=...

with the parameters listed on the linked page. I know it says not to but I think that information may be out of date.

BeRecursive
A: 

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.

Hung Bui
@HungBui Do you have a link to the forum post? the url you posted here doesn't seem to work.
jostster
I can't see to get this to work either. Here is a post that i see also that has not been answered by facebook. Wonder if this is a bug. http://forum.developers.facebook.net/viewtopic.php?pid=267984 found a bug reference also i think http://bugs.developers.facebook.net/show_bug.cgi?id=12696
Jim Zimmerman