使用php添加评论以响应youtube视频

时间:2012-03-30 06:52:22

标签: php youtube comments youtube-api

我想对某些YouTube视频的回复发表评论。我在PHP中使用youtube数据API,任何人都可以为我提供评论的PHP代码???

以下是此API的完整文档,也有关于评论,但提供的代码无效

$newComment = $yt->newCommentEntry();
$newComment->content = $yt->newContent()->setText('new comment');

// post the comment to the comments feed URL for the video
$commentFeedPostUrl = $videoEntry->getVideoCommentFeedUrl();
$updatedVideoEntry = $yt->insertEntry($newComment, $commentFeedPostUrl,
'Zend_Gdata_YouTube_CommentEntry');

我没有得到如何使用vedioEntry对象。 cz没有关于此对象的文档演示。任何人都可以告诉它如何运作.............
错误

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401 <HTML> <HEAD> <TITLE>User authentication required.</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>User authentication required.</H1> <H2>Error 401</H2> </BODY> </HTML> ' in C:\xampp\htdocs\youtube\Zend\Gdata\App.php:709 Stack trace: #0 C:\xampp\htdocs\youtube\Zend\Gdata.php(221): Zend_Gdata_App->performHttpRequest('POST', 'http://gdata.yo...', Array, '<atom:entry xml...', 'application/ato...', NULL) #1 C:\xampp\htdocs\youtube\Zend\Gdata\App.php(900): Zend_Gdata->performHttpRequest('POST', 'http://gdata.yo...', Array, '<atom:entry xml...', 'application/ato...') #2 C:\xampp\htdocs\youtube\Zend\Gdata\App.php(975): Zend_Gdata_App->post(Object(Zend_Gdata_YouTube_CommentEntry), 'http://gdata.yo...', NULL, NULL, Array) #3 C:\xampp\htdocs\youtube\operations.php(1162): Zend_Gdata_App->insertEntry(Object(Zend_Gdata_YouTube_CommentEntry), 'http://gdata.yo...', 'Zend_Gdata_YouT...') #4 C:\xampp\htdocs\youtube\ in C:\xampp\htdocs\youtube\Zend\Gdata\App.php on line 709

0 个答案:

没有答案