PHP CURL get streamer status

Hi, I am having a few problems getting this to work. With the latest API changes I’m a bit stuck. Could I get some help getting this to work again?

My aim for this script is to check if a streamer is live or not as well as showing how many viewers they currently have.

<?php

$name = $_GET["userchannelname"];
if(isset($name))
{
?>
<?php
$status = [];
foreach ($names as $name)
{
    $status[$name] = false;
}
$ch1 = curl_init('https://api.twitch.tv/helix/streams?user_login=' . $name . '');
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array(
    'Client-ID: **********',
'Authorization: Bearer *******'
));
$r1 = curl_exec($ch1);
$getdata1 = json_decode($r1, true);
$title1 = $getdata1['data'][0]['title'];
$viewers1 = $getdata1['data'][0]['viewer_count'];

$info = curl_getinfo($ch1);
curl_close($ch1);

if($info['http_code'] == 200)
{
    $result = json_decode($result);
    if(json_last_error() == JSON_ERROR_NONE)
    {
        $name = strtolower($stream->user_name);
    $status[$name] = true;
}
}
else {
echo 'Failed to decode JSON.';
}

foreach($status as $name => $state)
{
   if($state) {
    echo $name . " is live!";
}
else {
    echo "not live";
}
}

?>
Testing site: https://api.crossfire151.xyz/?userchannelname=wessicaaa

You have no code showing how you are fetching an oAuth token

oAuth app access tokens are covered here:

So sounds like you are using your client secret as a token in error