2011-03-03 7 views
3

私はyoutubeにアップロードするためのgoogleのapiの例に従った。私は、例えば、別のドメインでホストされているファイルをアップロードしたい場合は:PHP Youtube Data他のドメインからApiアップロード

$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); 

をすべてのヘルプは大幅に

答えて

0

をいただければ幸い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 
関連する問題