Hi,
I am using PHP to return a json object, everything seems to work fine, such as returning the No of Followers. However, when trying to return the number of viewers it’s not allowing me to do this.
See Code Below:
$channels = array('ChannelName') ;
$callAPI = implode(",",$channels);
$dataArray = json_decode(@file_get_contents('https://api.twitch.tv/kraken/streams?channel=' . $callAPI), true);
foreach($dataArray['streams'] as $mydata){
if($mydata['_id'] != null){
$name = $mydata['channel']['display_name'];
$viewers = $mydata['channel']['viewers'];
}
}
If i substitute the “ChannelName” for a channel which is live, it will not set the variable $viewers.
Can you see something obvious i am doing wrong.