diff --git a/PHP/Twitch/twitchstatus.php b/PHP/Twitch/twitchstatus.php index b6aa31b..207af08 100644 --- a/PHP/Twitch/twitchstatus.php +++ b/PHP/Twitch/twitchstatus.php @@ -30,24 +30,26 @@ else{ $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 = json_decode(file_get_contents_curl($account), true); +$account = json_decode(_file_get_contents_curl($account), true); if(!$account["display_name"]){ exit("Unknown channel."); } -$txt = "".$account["display_name"]."

"; if($stream["stream"] != null){ - $boxart = "http://static-cdn.jtvnw.net/ttv-boxart/".$stream["stream"]["game"].".jpg"; - $txt .= "Live!

"; - $txt .= "Playing: ".$stream["stream"]["game"]."
"; + $txt = "".$stream["stream"]["channel"]["status"]."
"; + $txt .= "".$account["display_name"]."

"; + $txt .= "Live!

"; + $txt .= "Playing: ".$stream["stream"]["game"]."

"; $txt .= "Viewers: ".$stream["stream"]["viewers"]."

"; + $boxart = "http://static-cdn.jtvnw.net/ttv-boxart/".$stream["stream"]["game"].".jpg"; } else{ - $boxart = "http://img7.imageshack.us/img7/9652/offlineeu.jpg"; + $txt = "".$account["display_name"]."

"; $txt .= "Offline.
"; + $boxart = "http://img7.imageshack.us/img7/9652/offlineeu.jpg"; } $txt .= "
Go to Channel"; @@ -69,7 +71,7 @@ exit; /* 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(); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);