See the snippet below, you can use this with an array of channels of course… but in the line i marked you have grave quotes instead of single quotes. This is breaking your check, I believe… any how… I added an example that uses cURL like Barry suggested.
<?php
$channels = array(
"STREAMER"
);
$callAPI = implode(",", $channels);
$clientID = 'TWITCHID';
$arrContextOptions = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false
)
);
$dataArray = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams?channel=' . $callAPI . '&client_id=' . $clientID, false, stream_context_create($arrContextOptions)), true);
foreach ($dataArray[‘streams’] as $mydata) {
if ($mydata[’_id’] != null) {
$name = $mydata[‘channel’][‘display_name’];
$game = $mydata[‘channel’][‘game’];
$url = $mydata[‘channel’][‘url’];
echo “ONLINE”;
}
}
if ($dataArray[‘streams’] == null or $dataArray[‘streams’] == “”) { <===IN HERE
echo "No Streams Online";
}
?>