POST comment via Youtube API
$url = 'http://www.youtube.com/feeds/api/videos/' . $video_id . '/comments';
$data = array('key' => $api_key);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type:
application/atom+xml\r\nContent-Length: {$text}\r\nAuthorization:
Bearer {$_access_token}\r\nGData-Version: 2\r\nX-GData-Key:
key=$api_key",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
I get
<b>Warning</b>:
file_get_contents(http://www.youtube.com/feeds/api/videos/ZButc20/comments):
No comments:
Post a Comment