Skip to content

Instantly share code, notes, and snippets.

@iamcal
Created April 20, 2018 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamcal/c4bd370b57adc262ff8aec30005e1d3e to your computer and use it in GitHub Desktop.
Save iamcal/c4bd370b57adc262ff8aec30005e1d3e to your computer and use it in GitHub Desktop.
<?
$lines = file('http://www.worldofwarcraft.com/realmstatus/status.xml');
foreach ($lines as $line){
if (preg_match('!Hyjal!', $line)){
preg_match_all('!([a-z]+)="([^"]*)"!', $line, $m, PREG_SET_ORDER);
$out = array();
foreach ($m as $mx){
$out[$mx[1]] = $mx[2];
}
$out[status] = $out[s] == 2 ? 'Down' : 'NOT DOWN';
$out[ts] = time();
print_r($out);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment