FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Warcraft III Profile/Roster Parser





Aredon
Well after a month or so of digging through blizzard's HTML. I have finally finished a parser that pulls from wc3 profiles. Basically using cURL I pull the HTML, painstakingly separate the data out, and output a nice clean array.

Usage:
include 'modules/wc3.php';
wc3_profile_array('username'); //outputs a global array, no need to set it to anything, just run it.
$player_wins=$wc3_profile['total']['wins']; // total wins by a player

Output: (The Array)
Array ([name] => HunterOriginal [clan] => THA [info] => I am the gentle whisper in the wind, the flickering light from the fire, the soothing cool from the water, and the messenger of the door. I am the calm in chaos, the serenity in war, and the enforcer of the unwritten. I am the kindness in your heart, the selflessness in your soul, and the protector of the innocent. I am of this world, and of another. I am that which I wish to be, and that which I need to be. I am here if you so call me thus to thee. If you call I shall be there, in one form or the next. [homepage] => Http://Clanhunter.Frih.Net [last_game] => 0 [Random] => Array ( [wins] => 3 [losses] => 4 [win%] => 42.86 % ) [Orc] => Array ( [wins] => 1 [losses] => 1 [win%] => 50.00 % ) [Undead] => Array ( [wins] => 248 [losses] => 239 [win%] => 50.92 % ) [Total] => Array ( [wins] => 252 [losses] => 244 [win%] => 50.81 % ) )

The Code!:
http://clanhunter.frih.net/navigation/modules/wc3.phps

I'll grant that it's not as clean as it could be, but it works! However, I have not yet coded arranged teams in yet (I got lazy). Anyways I hope you guys enjoy this code, I'll be using it to display data for my clan's website.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.