Another XBOX Snippet

This time this shows when you where “last seen” and what you were doing/playing. The snippet itself grabs the data from a script created by duncanmackenzie.net. The only downside to this snippet is that the data isn’t updated that often and on rare occasions doesn’t return any data, but I believe this is because of too many requests within a set time period. Remember to insert your gamertag instead of rentedsmile.

<?php

$ch = curl_init(‘http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=rentedsmile’);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,4);
$data = curl_exec($ch);
curl_close($ch);

$xml = new SimpleXmlElement($data,LIBXML_NOCDATA);

foreach ($xml->PresenceInfo as $mystatus) {
    echo  ’<div id=”xboxlivestatus”>’ . $mystatus->StatusText . ’ : ’ . $mystatus->Info . ’ </div>’;
}

?>

This will be the output:

Offline : Last seen 12/07/09 playing Left 4 Dead 2

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *

Puedes usar las siguientes etiquetas y atributos HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>