How to get Disqus comment count for a page using D

2019-09-06 15:11发布

How can we get Disqus comment count for a specific page using Disqus PHP?

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

Above snippet can be used to initialize the API object. What method to be called if a I have URL of a page in my website?

All my search leads to JavaScript samples to get comment count.

Thanks.

标签: php api disqus
2条回答
啃猪蹄的小仙女
2楼-- · 2019-09-06 15:17

Just access any of the methods provided by the 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;

Or get a list of most popular posts:

$popular_pages = $disqus->threads->listPopular(array('forum'=>YOUR_SHORTNAME));
查看更多
别忘想泡老子
3楼-- · 2019-09-06 15:17

I am not clear about your question.

You can get the thread details using following API https://disqus.com/api/3.0/threads/details.json.

response->posts is comment count for that page.

查看更多
登录 后发表回答