<?php error_reporting(0); ?>
<?php header('Content-Type: application/json'); ?>
<?php include './library/PEAR/Services/JSON.php'; ?>


<?php

$url = 'http://opi.yahoo.com/online?u=***-INSERT-YAHOO-ID-HERE-***&m=a&t=1';
$contents = file_get_contents($url);
$status = intval($contents);

$pres['yahoo_id'] = "***-INSERT-YAHOO-ID-HERE-***";
$pres['name'] = "***-INSERT-NAME-HERE-***";

if ($status == 00) {
	// NOT ONLINE
	$pres['show'] = 'offline';
} elseif ($status == 01) {
	// ONLINE
	$pres['show'] = 'available';
}


$encoder = new Services_JSON();
$output = $encoder->encode($pres);

?>

<?php print $output; ?>
