In an effort to relieve some of the [url=http://www.bungie.net/Forums/posts.aspx?postID=63693482]depression[/url] 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 [url=http://bnetmobile.site90.net/]over here[/url]. 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.
[url]http://www.megaupload.com/?d=B807RYCC[/url]
What it does: As an example, the [url=http://pastebin.com/g8LCvHza]HTML of the Community forum[/url], when fed into the "stuff", produces [url=http://pastebin.com/cjQQy0UX]a number of objects[/url] 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:[quote]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/Account/Profile.aspx?memberID=2758679"));
var_dump($p);[/quote]
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!
-
Nice, I now have the tools to start my b.net title booster bot! A few n-gram classifications, a Bayesian filter, and I am set!