Created
August 15, 2013 00:58
-
-
Save navarr/6237336 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
// This is a small PHP snippet to fetch the amount of viewers for a channel. | |
$data = @json_decode(file_get_contents('https://api.twitch.tv/kraken/streams/8_bit_hero'), true); | |
$viewerCount = 0; | |
if ($data && !is_null($data['stream'])) { | |
$viewerCount = $data['stream']['viewers']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment