作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在做一个YouTube应用程序项目。但是我无法对任何视频发表评论。我正在使用curl和php。我正确放置了所有功能,但显示出某种错误
如果我正在使用
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
$data_json
在哪里
{
"snippet": {
"topLevelComment": {
"snippet": {
"videoId": "<?php echo $videoid; ?>",
"textOriginal": "<?php echo $comment; >"
}
}
}
}
{ "error": { "errors": [ { "domain": "global", "reason": "parseError",
"message": "This API does not support parsing form-encoded input." } ],
"code": 400, "message": "This API does not support parsing form-encoded
input." } }
最佳答案
您需要提及content-type
header ,以便youtube
知道您要发送的内容。默认情况下,您现在正在使用form-encoded
输入。
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
关于php - 通过curl在youtube视频上发表评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35393313/
我计划在网页上安装 Facebook 评论模块/插件,比方说: http://www.example.com/ 是否可以将用户重定向到网站内的另一个登录页面?假设我想在点击发表评论后将它们发送到这里:
我是一名优秀的程序员,十分优秀!