我使用PHP Curl上傳視頻,效果很好。 我不斷收到這個當我嘗試刪除視頻:查找我所有的視頻,並將它們刪除youtube api
HTTP方法DELETE不受此URL支持 - 錯誤405
$headers = array("Authorization: GoogleLogin auth=".$authvalue,
"GData-Version: 2",
"Content-Type: application/atom+xml; charset=UTF-8",
"DELETE /feeds/api/users/".$username."/uploads/".$videoid." HTTP/1.1");
$curl = curl_init("http://gdata.youtube.com");
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_REFERER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_HEADER, 0);
$b = curl_exec($curl);
大聲笑,因爲什麼時候有人想刪除*所有*他們的視頻? btw你檢查過文檔嗎? – HamZa
那麼我有一個腳本,並在其中犯了一個錯誤,所以我必須刪除所有1500個視頻。而且不會手動完成。 :)它在100個不同的帳戶。是的,我有,但只有ZEND的例子,我不使用zend,但捲曲。 – jesper
根據文檔,您可以通過發送HTTP DELETE頭來刪除視頻。 https://developers.google.com/youtube/2.0/reference#Response_codes_deleting_information – Fracsi