- file_get_contents: documentation ( source)
- json_decode: documentation ( source)
<?php
$streamChannel = "your_channel";
$json_array = json_decode(file_get_contents("https://api.twitch.tv/kraken/streams.json?channel=$streamChannel"), true);
if(isset($json_array['streams'][0]['channel'])) {
echo "<div id='streamonline'>embed stuffs here</div>";
} else {
echo "<div id='streamoffline'>offline stuffs</div>";
}
?>