Created
May 26, 2011 02:37
-
-
Save puttputt/992430 to your computer and use it in GitHub Desktop.
Check if justin.tv stream is live, display if it is
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//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