如何获得Disqus留言计数使用Disqus PHP API页面? [英] How to get Disqus comment count for a page using Disqus PHP API?

查看:254
本文介绍了如何获得Disqus留言计数使用Disqus PHP API页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们怎样才能获得Disqus留言计数使用Disqus PHP?

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

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

上面的片段可以用来初始化API对象。有什么办法,如果我有一个页面的URL在我的网站被称为?

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?

我所有的搜索导致的JavaScript样本得到的评论数量。

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

感谢。

推荐答案

刚刚访问任何由API提供的方法:

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));

这篇关于如何获得Disqus留言计数使用Disqus PHP API页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆