sweet got it to work thnx
now im working on how to hide the offline channels and i have te feeling i have to do that by changing the :
foreach ($channels as $channel) { part.
so far i got this but cant get it to read $channel for the small video preview
<?php
$channels = [
'username 1',
'username 2'
];
$url = 'https://api.twitch.tv/helix/streams?user_login=' . implode('&user_login=', $channels);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Client-ID: qb04sm1wihjshxsrejejv5g053y4r0"
]);
$data = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
if ($info['http_code'] == 200) {
$data = json_decode($data);
if ($data->data) {
if (count($data->data) > 0) {
$live = array();
foreach ($data->data as $stream) {
$live[] = strtolower($stream->user_name);
}
foreach ($channels as $channel) {
echo '<iframe src="https://player.twitch.tv/?channel= $channel" frameborder="0" allowfullscreen="true" scrolling="no" height="200" width="200"></iframe>';
}
} else {
echo 'No Streamers Online';
}
} else {
echo 'Helix Error (No Data)';
}
} else {
echo 'Non 200 ' . $info['http_code'] . ' - ' . $data;
}
?>