根据twitch流是否处于活动状态而隐藏和取消隐藏的PHP代码存在资源错误

时间:2018-03-01 23:03:38

标签: php live-streaming twitch

我收到以下错误:

  

FATAL ERROR语法错误,意外' http' (T_STRING),期待','或';'在第8行

运行以下代码时:

<?php
$streamChannel = "randomstream";  

$json_array = json_decode(file_get_contents("https://api.twitch.tv/kraken/streams.json?channel=$streamChannel"), true);  

if(isset($json_array['streams'][0]['channel'])) {  
echo "<div id='streamonline'><iframe
src="http://player.twitch.tv/?channel=randomstream"
name="report"
height="100%"
width="100%"
frameborder="0"
scrolling="no"
allowfullscreen="true">
</iframe></div>";  
} else {  
echo "<div id='streamoffline'>Display 0</div>";  
}  

?>

此代码的目标是仅在流在目标网站上实时时才会嵌入实时抽搐流。

0 个答案:

没有答案