将视频上传到旧的Facebook REST API

编程入门 行业动态 更新时间:2024-10-07 03:26:26
本文介绍了将视频上传到旧的Facebook REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我尝试使用 https://api-video.facebook,我有很多上传视频的问题。

com 我得到一个cURL主机找不到错误,如果我使用 api-video.facebook 我收到一条消息使用 api-video.facebook

如果我尝试使用 api.facebook/restserver.php?method=video.upload 我收到一个101错误代码 -

< error_msg>无效的API密钥< / error_msg>

但API密钥适用于用户的其他一切,状态,评论,喜欢,fql? / p>

我要发送什么:

access_token = XXXX api_key = XXXX call_id = 1279204007.6003 description =描述+的+这个%3F 格式= JSON 标题=标题%2C + a +标题v = 2.0 sig = XXX

我在发表在 FB开发者论坛将会话密钥分解为|给你一个正确的会话密钥?这跟access_token是一样的吗?我已经尝试分裂这个没有运气。

任何想法,甚至PHP(!)中的工作代码将是最受欢迎的!谢谢

解决方案

尝试使用这个代码与FB SDK

require_once'facebook.php'; $ appapikey ='xxx'; $ appsecret ='xxx'; $ facebook = new Facebook($ appapikey,$ appsecret); $ session_key ='xxx'; //这是在要求offline_access扩展权限时返回的无限session_key $ args = array('method'=>'facebook.video.upload', 'v'=>'1.0','api_key'=> $ appapikey,'call_id'=> microtime(true),'format'=& ','session_key'=> $ session_key,'title'=>'我的视频标题','description'=>'我的视频说明' ); ksort($ args); $ sig =''; foreach($ args as $ k => $ v){ $ sig。= $ k。 '='。 $ V; } $ sig。= $ appsecret; $ args ['sig'] = md5($ sig); $ args [short.wmv] ='@E:\path\to\short.wmv'; $ ch = curl_init(); $ url ='api-video.facebook/restserver.php?method=facebook.video.upload'; 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); print_r($ data); // return xml here

我还发现了一个错误报告今天提交,表示视频上传已经工作并且不能正常工作。这可能是你的代码很好,Facebook的API正在搞砸。

编辑:

尝试以下,似乎已经为几个人工作了。

I'm having lots of issues with uploading videos.

If I try to use api-video.facebook I am getting a cURL host not found error, if I use api-video.facebook I get a message to use api-video.facebook

If I try to use api.facebook/restserver.php?method=video.upload I get a 101 error code -

<error_msg>Invalid API key</error_msg>

but the API key works for everything else, statuses, comments, likes, fql for the user?

Heres what I am sending:

access_token=XXXX api_key=XXXX call_id=1279204007.6003 description=Description+of+this%3F format=JSON title=Title%2C+a+title v=2.0 sig=XXX

I read in the post on the FB developers forum that splitting the session key by | gives you a correct session key? Is this the same as access_token? I have tried splitting this up with no luck.

Any ideas, or even working code in PHP (!) would be most welcome! Thanks

解决方案

Try using this code with the FB SDK

require_once 'facebook.php'; $appapikey = 'xxx'; $appsecret = 'xxx'; $facebook = new Facebook($appapikey, $appsecret); $session_key = 'xxx'; //this is the infinite session_key returned when asking for the offline_access extended permission $args = array( 'method' => 'facebook.video.upload', 'v' => '1.0', 'api_key' => $appapikey, 'call_id' => microtime(true), 'format' => 'JSON', 'session_key' => $session_key, 'title' => 'My video title', 'description' => 'My video description' ); ksort($args); $sig = ''; foreach($args as $k => $v) { $sig .= $k . '=' . $v; } $sig .= $appsecret; $args['sig'] = md5($sig); $args["short.wmv"] = '@E:\path\to\short.wmv'; $ch = curl_init(); $url = 'api-video.facebook/restserver.php?method=facebook.video.upload'; 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); print_r($data); //returned xml here

I also found a bug report submitted today stating that video uploads have been working and not working sporatically. It could be your code is just fine and facebook's APIs are messing up.

EDIT:

Try the following, it seems to have worked for a few people.

更多推荐

将视频上传到旧的Facebook REST API

本文发布于:2023-11-26 18:50:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634764.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视频   Facebook   API   REST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!