Can some help me / eplain to me what i did wrongh?

<?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) {
            foreach ($data->data as $stream) {
                echo '<iframe src="https://player.twitch.tv/?channel=' . strtolower($stream->user_name) . '" 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;
}
1 Like