如何使用 API 和 PHP 添加对 youtube 视频评论的回复


How to add reply to youtube's video comment using API with PHP

如何使用API和PHP添加对youtube视频评论的回复?

通过搜索一分钟,我找到了这个:https://developers.google.com/youtube/2.0/developers_guide_protocol_comments#Adding_a_comment

看起来像你需要的那个。当然,您需要对想要发表评论的用户进行身份验证。

要了解如何在 PHP 中发出POST请求,请参阅本文:http://www.lornajane.net/posts/2010/three-ways-to-make-a-post-request-from-php

这个库似乎很容易添加回复评论:https://github.com/jimdoescode/Zendless-PHP-YouTube-API

/**
 * Add a comment to a video or a reply to another comment.
 * To reply to a comment you must specify the commentId
 * otherwise it is just a regular comment.
 *
 * @param string $videoId the video the comment goes with.
 * @param string $comment the comment
 * @param string (optional) $commentId the id of the comment to reply to.
 * @return mixed false if not authenticated otherwise the http response is returned.
 **/
 public function addComment($videoId, $comment, $commentId = false)