问题
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.
回答1:
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));
回答2:
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.
来源:https://stackoverflow.com/questions/23630150/how-to-get-disqus-comment-count-for-a-page-using-disqus-php-api