我使用Codeigniter并通过Jim Saunders的库使用youtube API。 https://github.com/jimdoescode/CodeIgniter-YouTube-API-Library
上传视频,我很好但是如何在不使用Zend库的情况下将其删除?
我希望得到你的帮助:))
答案 0 :(得分:0)
如果没有方法,你必须手动完成。
文档显示了删除视频的示例请求:
DELETE /feeds/api/users/default/uploads/VIDEO_ID HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Authorization: AuthSub token="AUTHORIZATION_TOKEN"
GData-Version: 2
X-GData-Key: key=DEVELOPER_KEY
快速了解源代码,以下是请求的方式(在课堂内):
$header = "DETELE /feeds/api/users/default/uploads/".$VIDEO_ID." HTTP/".self::HTTP_1.self::LINE_END;
$extra = "Content-Type: application/atom+xml".self::LINE_END;
$extra .= "GData-Version: 2".self::LINE_END;
$fullrequest = $this->_build_header(false, $header, $extra, 'POST');
$handle = $this->_connect();
$this->_write($handle, $fullrequest);
$output = $this->_read($handle);
fclose($handle);
$handle = null;
可能无法完全发挥作用,但希望能够朝着正确的方向发展。