function c_twitter($input) { if ($input[1] == "") { $output = "Which user do you want to check?\r<strong>twitter username</strong>"; } else { $url = "http://twitter.com/status/user_timeline/" . htmlentities($input[1]) . ".json?count=10"; $rawdata = c__feeder($url, null, true); $data = json_decode($rawdata, true); $output = $data[0]["text"]; } return $output; }
function c_feel($input) { if ($input[1] == "") { $output = "What feeling are you looking for?\r<strong>feel hungry</strong>"; } else { $url = "http://api.wefeelfine.org:8080/ShowFeelings?display=json&returnfields=sentence&postdate=" . date("Y-m-d") . "&limit=1&feeling=" . htmlentities($input[1]); $data = c__feeder($url, null, true); $output = strip_tags($data); if ($output == "") { $output = "nobody's feeling " . $input[1] . " at the moment..."; } } return $output; }
function c_delicious($input) { if ($input[1] == "") { $output = "Which user do you want to check?\r<strong>delicious username</strong>"; } else { $url = "http://feeds.delicious.com/v2/json/" . htmlentities($input[1]); $rawdata = c__feeder($url, null, true); $data = json_decode($rawdata, true); if ($data[0]['u'] == $url && $data[0]['d'] == '404 Not Found') { $output = 'User "' . $input[1] . '" not found.'; } else { $output = '<a href="' . $data[0]['u'] . '">' . $data[0]['d'] . '</a> <strong>(posted at ' . $data[0]['dt'] . ')</strong>'; } } return $output; }
function c_last($input) { if ($input[1] == "") { $output = "Which user do you want to check?\r<strong>last username</strong>"; } else { $url = "http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&api_key=79455252ccf334688fc8efe7c5600c3b&user="******"&format=json"; $rawdata = c__feeder($url, null, true); $data = json_decode($rawdata, true) or die; $output = "On <strong>" . $data["recenttracks"]["track"][0]["date"]["#text"] . "</strong>, "; $output .= $input[1] . " listened to <strong>" . $data["recenttracks"]["track"][0]["name"] . "</strong>"; $output .= " by <strong>" . $data["recenttracks"]["track"][0]["artist"]["#text"] . "</strong>"; if ($data["recenttracks"]["track"][0]["album"]["#text"] != "") { $output .= " from the album <strong>" . $data["recenttracks"]["track"][0]["album"]["#text"] . "</strong>"; } } return $output; }