Fuzzy status of who’s online at reddit
This is some quick and dirty little code to test without much precision if any particular user is online over at Reddit.
$url='http://www.reddit.com/user/HattoriHanzo.json';
//get the url | json decode it to an array
$j=json_decode(file_get_contents($url),1);
//this just grabs the first element and then its timestamp
$t=$j[data][children][0][data][created_utc];
//this is a delay of 15 min. use std. timestamp math
if((time()-$t) < (60 * 15)){
//and they are online ;)
}
//or offline ;(

This code is pig disgusting.
* Whitespace,please.Peopledon’twritelikethis.
* Using undefined constants as strings relies on non-standard behavior and should be throwing warnings.
* It’s in PHP.