如何使用Disqus PHP API获取页面的Disqus评论数?

时间:2014-05-13 11:35:12

标签: php api disqus

我们如何使用Disqus PHP获取特定页面的Disqus评论数?

require_once('disqusapi/disqusapi.php');
$disqus = new DisqusAPI('sec_key');

上面的代码段可用于初始化API对象。如果我的网站中有网页的网址,可以调用哪种方法?

我的所有搜索都会引导JavaScript示例以获得评论数。

感谢。

2 个答案:

答案 0 :(得分:2)

只需访问API提供的任何方法:

require_once('disqusapi/disqusapi.php');
$disqus = new DisqusAPI('sec_key');
$page_with_comments = $disqus->posts->details(array('thread'=>THREAD_IDENTIFIER));
$comment_count = $page_with_comments->posts;

或获取最受欢迎的帖子列表:

$popular_pages = $disqus->threads->listPopular(array('forum'=>YOUR_SHORTNAME));

答案 1 :(得分:-1)

我不清楚你的问题。

您可以使用以下API获取主题详细信息 https://disqus.com/api/3.0/threads/details.json

response->posts是该页面的评论计数。