0
我會更新的視頻與這樣的代碼:如何通過php api更新YouTube視頻?
$headers = array("PUT /feeds/api/users/default/uploads/VIDEOID HTTP/1.1",
"Host: gdata.youtube.com",
"Authorization: GoogleLogin auth=".$authvalue,
"GData-Version: 2",
"X-GData-Key: key=KEY",
"Content-length: ".strlen($data),
"Content-Type: application/atom+xml; charset=UTF-8");
$curl = curl_init("https://gdata.youtube.com/feeds/api/users/default/uploads/VIDEOID");
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, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_REFERER, true);
curl_setopt($curl, CURLOPT_HEADER, 0);
$returnxxx = curl_exec($curl);
curl_close($curl);
echo $returnxxx;
我已經生成的Valide authvalue(測試它 - >確定)。但它表明:
無效的URI
感謝您的幫助!
你的意思是上傳? –
你的頭文件正在定義一個PUT,但你正在設置捲曲來做一個POST。換句話說,你需要使用CURLOPT_PUT。 –
@Kiro Coneski否 - 我將更新/編輯視頻信息 - >請參閱https://developers.google.com/youtube/2.0/developers_guide_protocol_updating_and_deleting_videos謝謝! – user1756209