$Diablo3 = new Diablo3($user, $region, DEFAULT_LOCALE); // Battle.net Tag. (e.g. 'XjSv#1677' or 'XjSv-1677') (string), Server: 'us', 'eu', etc. (string) [Optional, Defaults to 'us'], Locale: 'en', 'es', etc. (string) $CAREER_DATA = $Diablo3->getCareer(); $calls++; if (is_array($CAREER_DATA)) { // MAKE HERO LIST // $hero_list = array(); foreach ($CAREER_DATA['heroes'] as $key => $value) { $hero_list[] = $value['id']; } // GET HERO DATA // $HERO_DATA = array(); foreach ($hero_list as $key => $hero) { $HERO_DATA[] = $Diablo3->getHero($hero); // Hero ID (int) $calls++; } // Career // $last_career_insert = $career_collection->find(array('battleTag' => $CAREER_DATA['battleTag'], '_region' => $region))->sort(array('lastUpdated' => -1))->limit(1); $last_career_date = null; foreach ($last_career_insert as $key => $value) { $last_career_date = $value['lastUpdated']; } // INSERT CAREER IF (lastUpdated > $last_career_date) // if (!is_null($last_career_date)) { if ($full_insert || $CAREER_DATA['lastUpdated'] > $last_career_date) { echo "Inserted 1 Career Record<br>";
<?php // For timing $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $start = $time; // For timing require_once 'diablo3.api.class.php'; // Settings set_time_limit(0); ini_set('memory_limit', '128M'); $Diablo3 = new Diablo3("XjSv#1677", 'us', 'en_US'); // Battle Tag (e.g. 'XjSv#1677' or 'XjSv-1677') (string), Server: 'us', 'eu', etc. (string), Locale: 'en_US', 'es_MX', etc. (string) $CAREER_DATA = $Diablo3->getCareer(); $HERO_DATA = $Diablo3->getHero(3982160); // Hero ID (int) $ITEM_DATA = $Diablo3->getItem('item/COGHsoAIEgcIBBXIGEoRHYQRdRUdnWyzFB2qXu51MA04kwNAAFAKYJMD'); // Item Data 'item/COGHsoAIEgcIBBXIGEoRHYQRdRUdnWyzFB2qXu51MA04kwNAAFAKYJMD' (string) $FOLLOWER_DATA = $Diablo3->getFollower('templar'); // Options: 'enchantress', 'templar', 'scoundrel' (string) $ARTISAN_DATA = $Diablo3->getArtisan('blacksmith'); // Options: 'blacksmith', 'jeweler' (string) $ITEM_IMAGE = $Diablo3->getItemImage('unique_chest_013_104_demonhunter_male', 'large'); // Icon Name, Size: Options: 'small', 'large' (string) $SKILL_IMAGE = $Diablo3->getSkillImage('barbarian_frenzy', '64'); // Icon Name, Size: Options: '21', '42', '64' (string) $SKILL_TOOLTIP = $Diablo3->getSkillToolTip('skill/barbarian/frenzy', true); // tooltipUrl, true for jsonp $SKILL_RUNE_TOOLTIP = $Diablo3->getSkillToolTip('rune/frenzy/a', false); // tooltipUrl, true for jsonp
// an error message: 'Function not available without a BattleTag' // $CAREER_DATA = $Diablo3->getCareer(); // Before handling the data check to make sure the return is an array // If the data is not an array then something went wrong. // if (!is_array($CAREER_DATA)) { echo 'Error.'; echo '<pre>'; var_dump($CAREER_DATA); echo '</pre>'; die; } // Get Hero Data By ID // $HERO_DATA = $Diablo3->getHero(52155363); if (!is_array($HERO_DATA)) { echo 'Error.'; echo '<pre>'; print_r($HERO_DATA); echo '</pre>'; die; } //*/ // Scrape to get ranking // @todo: Cache this $r = file_get_contents('http://us.battle.net/d3/en/rankings/season/1/rift-hardcore-wizard'); $dom = new DOMDocument(); $dom->loadHTML($r); $xpath = new DOMXPath($dom); $domranks = $xpath->query('//div[@id="ladders-table"]//tr/td[@class="cell-Rank"]');