In an effort to relieve some of the depression around here, I figured I'd this might be something people would be interested in.
Some of you know about the mobile site I wrote up site over here. There is stuff going on behind the scenes there which converts a regular page on bungie.net to one of the equivalent ones you see on that site. What I'd like to share with everyone is the "stuff" which does that.
http://www.megaupload.com/?d=B807RYCC
What it does: As an example, the HTML of the Community forum, when fed into the "stuff", produces a number of objects for programmatic access.
Download is a standard .zip file which contains 14 .php scripts (or simply text files for the layperson). All of them contain class or interface definitions. Only one method performs I/O - BungieNetPost::ResolvePostID - which is a HEAD request to Bungie.net using cURL (it isn't called anywhere in any class file). Otherwise, none of the scripts will write or read.
Example usage:function __autoload($className){
require_once("../classes/" . $className . ".php");
}
$f = new BungieNetForum(file_get_contents("http://www.bungie.net/ Forums/topics.aspx?forumID=3"));
var_dump($f);
$t = new BungieNetTopic(file_get_contents("http://www.bungie.net/ Forums/posts.aspx?postID=15804986"));
var_dump($t);
$p = new BungieNetUser(file_get_contents("http://www.bungie.net/A ccount/Profile.aspx?memberID=2758679"));
var_dump($p);
Few notes:
- Tested on PHP 5.3.3 (earlier versions may have "difficulties").
- If you don't like the way things are parsed, you're welcome to change it.
- Some of the properties may/may not be used (if ever). Remember: what the scripts can access is dependent on what bungie.net makes available through HTML, so a lot of the time things will be null.
- From the example above, it can parse a forum, topic, or profile page, but a lot of what's in there can probably be reused for other things (eg. inbox, private group forums, etc...).
Standard/Obvious disclaimer: Use at your own risk. I am not responsible in any way for how you use what's provided (eg. getting yourself IP banned).
Have fun!