我按照google api示例上传到youtube。但是,如果我想上传一个托管在另一个域上的文件,例如:
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $yt->newMediaFileSource('http://www.myotherdomain.com/.../file.mov');
$filesource->setContentType('video/x-flv');
// set slug header
$filesource->setSlug('http://www.myotherdomain.com/.../file.mov');
// add the filesource to the video entry
$myVideoEntry->setMediaSource($filesource);
任何帮助将不胜感激
最佳答案
Zend API可能不支持此功能。但是,如果您具有写权限,则可以将文件下载到服务器上,然后发送。
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_URL, 'http://www.myotherdomain.com/.../file.mov');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$contents = curl_exec($curl);
curl_close($curl);
$file = fopen('temp/file.mov', 'w'); // If file is not found, attempts to create it
fwrite($file, $contents);
fclose($file);
// Upload via YouTube