Updated layout on php/twitch/twitchstatus.php
This commit is contained in:
parent
58a9dcbc8b
commit
9297f163ae
|
@ -30,24 +30,26 @@ else{
|
||||||
|
|
||||||
|
|
||||||
$stream = "https://api.twitch.tv/kraken/streams/".$name;
|
$stream = "https://api.twitch.tv/kraken/streams/".$name;
|
||||||
$stream = json_decode(file_get_contents_curl($stream), true);
|
$stream = json_decode(_file_get_contents_curl($stream), true);
|
||||||
$account = "https://api.twitch.tv/kraken/channels/".$name;
|
$account = "https://api.twitch.tv/kraken/channels/".$name;
|
||||||
$account = json_decode(file_get_contents_curl($account), true);
|
$account = json_decode(_file_get_contents_curl($account), true);
|
||||||
|
|
||||||
if(!$account["display_name"]){
|
if(!$account["display_name"]){
|
||||||
exit("Unknown channel.");
|
exit("Unknown channel.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$txt = "<b>".$account["display_name"]."</b><br><br>";
|
|
||||||
if($stream["stream"] != null){
|
if($stream["stream"] != null){
|
||||||
$boxart = "http://static-cdn.jtvnw.net/ttv-boxart/".$stream["stream"]["game"].".jpg";
|
$txt = "<b>".$stream["stream"]["channel"]["status"]."</b><br>";
|
||||||
$txt .= "<small><b>Live!</b><br><br>";
|
$txt .= "<small><b>".$account["display_name"]."</b><br><br>";
|
||||||
$txt .= "<b>Playing:</b> ".$stream["stream"]["game"]."<br>";
|
$txt .= "<b>Live!</b><br><br>";
|
||||||
|
$txt .= "<b>Playing:</b> ".$stream["stream"]["game"]."<br><br>";
|
||||||
$txt .= "<b>Viewers:</b> ".$stream["stream"]["viewers"]."</small><br>";
|
$txt .= "<b>Viewers:</b> ".$stream["stream"]["viewers"]."</small><br>";
|
||||||
|
$boxart = "http://static-cdn.jtvnw.net/ttv-boxart/".$stream["stream"]["game"].".jpg";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$boxart = "http://img7.imageshack.us/img7/9652/offlineeu.jpg";
|
$txt = "<b>".$account["display_name"]."</b><br><br>";
|
||||||
$txt .= "<small><b>Offline.</b></small><br>";
|
$txt .= "<small><b>Offline.</b></small><br>";
|
||||||
|
$boxart = "http://img7.imageshack.us/img7/9652/offlineeu.jpg";
|
||||||
}
|
}
|
||||||
$txt .= "<br><a href=\"".$account["url"]."\" target=\"_blank\"><b>Go to Channel</b></a>";
|
$txt .= "<br><a href=\"".$account["url"]."\" target=\"_blank\"><b>Go to Channel</b></a>";
|
||||||
|
|
||||||
|
@ -69,7 +71,7 @@ exit;
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS */
|
/* FUNCTIONS */
|
||||||
function file_get_contents_curl($url, $agent = "My Agent", $cookie = false, $post = false){
|
function _file_get_contents_curl($url, $agent = "My Agent", $cookie = false, $post = false){
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
||||||
|
|
Reference in New Issue