function twitchAPIRequest($url)
{
$output = file_get_contents($url);
return $output;
}
function decodeJ($json)
{
$decodedJson = json_decode($json);
$list = "<ul>";
for($i = 0; $i < $decodedJson->_total-1; $i++)
{
$videos = $decodedJson->videos[$i]->_id;
$preview = $decodedJson->videos[$i]->preview;
$list.="<li><a href='screen.php?vid={$videos}'><img src={$preview} width='180' height='112'></a></li>" ;
}
$list.="</ul>";
return $list;
}
$json = twitchAPIRequest("https://api.twitch.tv/kraken/channels/MYCHANNEL/videos?broadcasts=true");
The decodeJ function is called from html . I get no response from the api call. It works locally fine