I’ve just realised that my stream status does not work anymore and read that I have to include a client ID in the header. How do I do this?
That is my code:
function twitch($channel){
$clientID = "XXX";
$response = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams/'.strtolower($channel).'&client_id=' . $clientID), true);
if ($response['stream'] !== null) {
$follower = $response['stream'][0]['channel']['followers'];
$viewer = $response['stream']['viewers'];
echo ("Twitch: <span class='live'>Live</span><br>");
echo ("Viewers: ".$viewer);
} else {
echo ("Twitch: <span class='offline'>Offline</span>");
}
}
?>
It still shows error 400.