Created
April 27, 2015 19:39
-
-
Save Spea/522156fb99f504d834cc to your computer and use it in GitHub Desktop.
Get wow token price
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$price = getTokenPrice(); | |
function getTokenPrice($region = 'EU') | |
{ | |
$filename = 'wowtoken.json'; | |
if (file_exists($filename) && filemtime($filename) > time() - 1200) { | |
$content = file_get_contents($filename); | |
} else { | |
$content = file_get_contents('https://wowtoken.info/wowtoken.json'); | |
file_put_contents($filename, $content); | |
} | |
$wowtoken = json_decode($content, true); | |
$updateInformation = $wowtoken['update']; | |
if (isset($updateInformation[$region])) { | |
return $updateInformation[$region]['raw']['buy']; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment