Im trying to show streams online, with the image preview, the other things work, but i cant get the image preview working.
function get_url_contents($url){
$crl = curl_init();
curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, false);
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL,$url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}
$url = "https://api.twitch.tv/kraken/search/streams?limit=25&offset=0&q=Age%20of%20Empires%20II:%20The%20Conquerors ";
$json = get_url_contents($url);
$json = json_decode($json);
foreach($json->streams as $stream) {
echo '<img alt="" style="float: left; width: 50px; padding-right: 7px;" src="' . $stream->channel->logo . '" />';
echo $stream->channel->status . '<br />';
echo $stream->channel->display_name . ' esta jugando ' . $stream->channel->game . '.<br />';
echo '<img alt="" src="' . $stream->preview . '" /> <br />';
echo '<a href="http://www.twitch.tv/' . $stream->channel->name . '">Ver en vivo</a>';
echo '<hr />';
the problem is in this sentence echo '<img alt="" src="' . $stream->preview . '" /> <br />';
without this sentence, everything work,with this sentence, nothing work . Help , thx