OpenRaid

Forums

You have private messages. Click to view them. You can access the forum via 'Board index'. See 'OpenRaid/My Account/Preferences' to change this behaviour.

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:

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.php

Return to the homepage