How we use Battle.net data
We are not in any way affiliciated or associated with Blizzard or Battle.net. We are obligated to provide the sourcecode of the code that communicates with Battle.net. Below you can find that code:
Return to the homepage
class battlenet {
public function getRealms($region="eu")
{
$url = "http://" . $region . ".battle.net/api/wow/realm/status";
return json_decode(file_get_contents($url));
}
public function getRaces($region="eu")
{
$url = "http://" . $region . ".battle.net/api/wow/data/character/races";
return json_decode(file_get_contents($url));
}
public function getClasses($region="eu")
{
$url = "http://" . $region . ".battle.net/api/wow/data/character/classes";
return json_decode(file_get_contents($url));
}
public function getChar($realm, $char, $region="eu")
{
$url = "http://" . $region . ".battle.net/api/wow/character/" . $realm . "/" . $char . "?fields=guild,items,progression,talents,stats";
return @json_decode(file_get_contents($url));
}
}
The output from all above functions is stored locally in our database:class character extends CI_Model {
//...
private function sync(...)
{
// ...
$data = $this->battlenet->getChar($realmData->slug, $charName, $region);
// Store the $data in the database.
}
//...
}
Download this battlenet.phpReturn to the homepage
Follow Us
Follow us at other places on the web for more information and updates