<?php
$channels = array(‘monstercat’, ‘DeadlyFamous’, ‘celplays’) ;
$callAPI = implode(“,”,$channels);
$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, 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 "<h2>" .$name. " - " .$game. "</h2> <iframe src='http://www.twitch.tv/" .$name. "/embed' frameborder='0' scrolling='no' height='450' width='620' style='display: table; margin:0 auto; -webkit-box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0.75); -moz-box-shadow:0px 0px 5px 5px rgba(0, 0, 0, 0.75); box-shadow:0px 0px 5px 5px rgba(0, 0, 0, 0.75);'> </iframe>"; }else{ echo "<p>test</p>"; }}
?>
seemed to do it, in case others have the same problem i’ll keep this code here. Only thing in this code that doesn’t work is that if every of the streamers is offline the
echo "<p>test</p>";
does not show up.