Url API v3 to v5

This is complete code i used:

<?php

$channels = array('channel1','channel2') ;

$callAPI = implode(",",$channels);

$dataArray = json_decode(@file_get_contents("https://api.twitch.tv/kraken/streams?channel=" . $callAPI . "&amp;client_id=XXX", false, stream_context_create($arrContextOptions)), true);

if(is_array($dataArray)){

foreach($dataArray['streams'] as $mydata){

if($mydata['_id'] != null){

$name = $mydata['channel']['display_name'];

$game = $mydata['channel']['game'];

$url = $mydata['channel']['url'];

?>

<div id="twitch-embed" class="twitch-embed">

<?php echo "<p><h2><a href='".$url."'> ".$name. " sta giocando a " .$game."</a></h2><br></p>" ; ?>

</div>

<script src="https://embed.twitch.tv/embed/v1.js"></script>

<script type="text/javascript" style="padding: 0 10px;">

new Twitch.Embed("twitch-embed", {

width: 854,

height: 399,

channel: "<?php echo "" .$name. ""; ?>"

});

</script>

<?php

}else{

echo "<p>test</p>";

} } }

if($dataArray['streams'] == null or $dataArray['streams'] == "")

{ ?>

<div id="twitch-embed" class="twitch-embed">

<?php

echo "<p><;h2>Message offline.<;/h2></p>";

echo "<p><h2>submessage</h2></p>;";

}

?>

</div>