#1 - Aug. 13, 2012, 10:57 a.m.
I get this:
http://eu.battle.net/d3/de/tooltip/item/CMWr9IwGEgcIBBWtxURkHYfEFu8d5OWp8B2VAm2tHTykUAcdbUIXxCILCAAVqv4BABgwIB4wCTiBA0AAUA5ggQM?&format=jsonp
I need this:
http://eu.battle.net/d3/de/tooltip/item-data/CPupgsgLEgcIBBXQ-MgVHRwSc-AdIuzMuB3eJVLLHaaTxPYdiL6-ISILCAEVtUQDABgQIAgwCTijBEAASAtQDmCjBA?classIcon=barbarian&gender=male&format=jsonp
To get the data I do a hero profile request via:
http://eu.battle.net/api/d3/profile/TAG/hero/HEROID
The result has items. Foreach item there is a tooltipParam value. That value is incorrect. It has "item/" but should have "item-data/".
Basically a replace of "item/" to "item-data/".
That delivers the item in JSONP thus I can create a tooltip from it. With the hack it works flawlessly.
*update*
It seems either your servers are currently in the state of updating or the update is missing on some of the servers that handle the request. Because sometimes the request is delivering the correct tooltipParam values and sometimes it just does not.
Testcase:
<?php
//function and variables
function getJsonDataViaCurl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$json = curl_exec($ch);
curl_close ($ch);
return $json;
}
$url = "http://eu.battle.net/api/d3/profile/claedeus-1800/hero/397960";
print $url;
//json data
$json = getJsonDataViaCurl($url);
//gen php array from json code
$hero = json_decode($json, true);
echo '<pre>'.$eol;
foreach($hero['items'] as $key=>$elem) {
print($elem['tooltipParams'])."\n";
}
echo '</pre>'.$eol;
?>
