youtube上传的卷曲回复
问题描述:
我还有一个关于YouTube上传的问题。根据我从这里收到的答案(replace form input file with direct file upload),该脚本完美地上传了视频。但是,卷曲响应是“暂时移动”。我需要的是取回YouTube视频ID。youtube上传的卷曲回复
另一个问题是“nexturl”永远不会被调用。如果它被调用,我可以用“$ _GET ['id']”轻松读取视频ID并将其写入数据库。
下面的代码我与
$ch = curl_init($response->url."?nexturl=".urlencode($nexturl));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($ch, CURLOPT_POST, true);
$post = array(
"file"=>"@/path/to/file.avi",
"token"=>$response->token
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
感谢, 弗洛里安
答
没有测试我猜想,如果添加FOLLOWLOCATION选项,你会得到你以后的工作:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
完美答案,谢谢! – Florian