http://docs.disqus.com/help/58/
Can someone show be howto get that working? I'm not sure I understand how to use the code shown in a real life context.
I've created a database and have downloaded the PHP API, but im not sure howto use it even with the documentation linked above.
I presume to save and check for the posts at regular intervals I'll need to use CRON, but I should be able to get that myself if I can figure out howto work with the API.
Thanks
Fatal error: Uncaught exception 'Exception' with message 'Missing required argument: forum'
^^ That's the error I get when I try to make it work with the most basic example below:
$DisqusAPI = new DisqusAPI('my_api_key');
// query our MAX datestamp
$since = "SELECT MAX(nDA) FROM news";
$params = array('forum'=>'my_forum_name','since'=>(int)$since,'limit'=>100);
// fetch newer than posts from API
$posts = $DisqusAPI->forums->listPosts(json_decode($params));
// save posts locally
foreach ($posts as $post) {
//save($post);
}
Basically what they're saying is you need to create a database table (or some other datastore) to hold comments you download from Disqus to your site. They provide a recommended schema for a database table.
You would then use their API client (the one you downloaded) to pull down the comments, loop over them and store them in your database. They give you guidelines to make sure the interaction is lean by not downloading all the comments at once, and only downloading ones you may not have downloaded yet.
You might want to download the Wordpress plugin and read through it for a complete practical application using the client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With