Skip to content

Instantly share code, notes, and snippets.

@puttputt
Created May 26, 2011 02:37
Show Gist options
  • Save puttputt/992430 to your computer and use it in GitHub Desktop.
Save puttputt/992430 to your computer and use it in GitHub Desktop.
Check if justin.tv stream is live, display if it is
<?
//Script for Saskgamers.com
//Determines if a user's justin.tv stream is online, then displays it if it is
//To add more streams add the justin.tv channel id to the $streams array
$chan = "";
$streams = array(
"puttly", "j4sh", "strainkiss", "milfhunter", "gorgenzola", "steven_bonnell_ii"
);
echo "<span class=\"smalltext\"><strong>Live User Streams:</strong> ";
foreach ($streams as &$i) {
$chan = "http://api.justin.tv/api/stream/list.json?channel=" . $i;
$json = file_get_contents($chan);
$exist = strpos($json, 'name');
if($exist) {
echo " <a href=\"http://justin.tv/" . $i . "\">" . $i . "</a>";
}
}
echo "</span><br />";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment