I’ve foud this on the blog which outlines the need for the Client ID: https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843#.hzfyzk6yc but I cannot for the life of me work out how to integrate the client ID into the code I have.
I read on the Github:
In situations where headers cannot be set, you can also specify a client ID as a querystring parameter: client_id=<client_id>
Which I understand as I can use this in my code: client_id=$clientid but again, I really do not know where this would need to go.
Based on the change George advised, my code now looks like this:
<?php
$streamChannel = "mastersonothing";
$url = "https://api.twitch.tv/kraken/streams?channel=mastersonothing"
$clientid = "12345678901234"
$json_array = json_decode(curl($url), true);
if(isset($json_array['streams'][0]['channel'])) {
echo "<div id='streamonline'>Stream is Online</div>";
} else {
echo "<div id='streamoffline'>Stream is Offline</div>";
}
?>
If someone could please advise where this client ID needs to go, I would be greatly appreciative. I’ve read the blog post as well as the Github and I don’t understand it. As I mentioned in my original post, this is not my area or expertise. Thanks!