November 13, 201214 yr Hey, I've got a PHP file that outputs text, it shows how many people are watching a video, for example, "3286". Example: http://mylzh.net/stream/viewers.php?stream=kungentv Example 2: http://mylzh.net/stream/viewers.php?stream=tsm_theoddone It keeps changing. I have another PHP file that displays an image to show if that video is online or offline. For example: http://mylzh.net/stream/stream.php?stream=tsm_theoddone (Green if online, Red if offline) I can take that image from that file into the HTML easily with <img src="http://mylzh.net/stream/stream.php?stream=tsm_theoddone"> but how could I get the text into the HTML file? Thanks, - Luke
November 14, 201214 yr If you are a developer in http://mylzh.net you can display that value using php.
November 14, 201214 yr Author If you are a developer in http://mylzh.net you can display that value using php. Sure, the code is: <?php $stream = $_GET['stream']; $streamData = json_decode(file_get_contents("http://api.justin.tv/api/stream/summary.json?channel={$stream}"),true); $viewers = $streamData['viewers_count']; echo $viewers; ?> Edited November 14, 201214 yr by LukeeeeBennett
November 15, 201214 yr Sure, the code is: <?php $stream = $_GET['stream']; $streamData = json_decode(file_get_contents("http://api.justin.tv/api/stream/summary.json?channel={$stream}"),true); $viewers = $streamData['viewers_count']; echo $viewers; ?> LukeeeeBennett Thanks for this code..
Create an account or sign in to comment