这似乎是一个持续的问题,其他人以及我..但即使在“问题,可能已经有你的答案”发布时,我仍然无法得到这个工作。使用PHP获取面板评论数
我真正想要的是通过传递文章的标识符(或URL)给定文章的评论数。
我从github上下载了这个:https://github.com/disqus/disqus-php
跟着这里的第一个答案:How to get Disqus comment count for a page using Disqus PHP API?这似乎最接近我试图实现。这使我这个远:
<?php
require_once('scripts/disqusapi/disqusapi.php');
$disqus = new DisqusAPI('secret_key');
$page_with_comments = $disqus->posts->details(array('thread'=>"LINK-IDENTIFIER"));
$comment_count = $page_with_comments->posts;
?>
当我做到这一点,但是我正在此错误:
Fatal error: Uncaught exception 'Exception' with message 'Missing required argument: post' in /home/mugheads/public_html/scripts/disqusapi/disqusapi.php:82 Stack trace: #0 /home/mugheads/public_html/test.php(4): DisqusResource->__call('details', Array) #1 /home/mugheads/public_html/test.php(4): DisqusResource->details(Array) #2 {main} thrown in /home/mugheads/public_html/scripts/disqusapi/disqusapi.php on line 82
此错误表明您可以不再使用“线”来检索JSON需要..我无法找到ID Disqus使用的帖子,因为使用“post”就像错误描述只接受一个整数。
如果有人知道更简单的方法,或绝对有效的方式,请分享!
任何帮助将不胜感激!
也许用'post'取代'thread' – Augwa
感谢您的回复!当我这样做,它告诉我发布必须是一个整数..但没有办法我的知识使用身份证的,而不是文字来识别帖子。 – Zephni