OK, as promised, here's an updated 'quick(!) and dirty' class for retrieving and setting data via the Daniweb API. It allows the extraction of data based around:
- activity points
- who am i? (me - more data than from non-OAuth members)
- articles (expansion of non-OAuth articles)
- watched articles (watch and unwatch)
- voting on posts (upvote and downvote)
- PMs (currently inactive)
- get data for RSS
This is in no way 'production'-standard code. It is intended for picking apart in order to build your own solutions, e.g. if you intend on using the API or entering the API contest. NB - there is very poor error checking / no exception handling.
Also check out pritaeas' class(es).
require 'dwapi.class.php'; $dw = new dwAPI; echo $dw->getForums(); //echo json output of all forums echo $dw->getForums(false,17) //echo data about the PHP (#17) forum echo $dw->getList('http://www.daniweb.com/api/members/1/posts?filter=solved'); // get direct url data. NO CHECKS!
//set $client_id and $client_secret require 'dwapi.class.php'; $dw = new dwAPI($client_id, $client_secret); echo $dw->getMe(); //get my data
require 'dwapi.class.php'; $dw = new dwAPI; echo $dw->formatFeed($dw->getRSS(17),5); //echo first 5 links from PHP (#17)
Hope it helps. Oh, and as always, please feel free to point out errors, improvements and any daft implementations. diafol :)