簡體   English   中英

如何使用Disqus PHP API獲取頁面的Disqus評論數?

[英]How to get Disqus comment count for a page using Disqus PHP API?

我們如何使用Disqus PHP獲取特定頁面的Disqus評論數?

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

以上代碼段可用於初始化API對象。 如果我的網站中有頁面的網址,應該調用什么方法?

我所有的搜索都導致JavaScript示例獲得評論計數。

謝謝。

只需訪問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));

我不清楚你的問題。

您可以使用以下API https://disqus.com/api/3.0/threads/details.json獲取線程詳細信息。

response->posts是該頁面的評論數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM