The documentation of the Twitch API recommends adding a Client ID on every request you make. Now I’m unsure how to do this in PHP.
Some of my code looks like follows:
function is_twitch_user_online($user_id) {
if ( get_user_meta($user_id, 'twitch', true) ) {
$twitch_name = get_user_meta($user_id, 'twitch', true);
$jsonurl = "https://api.twitch.tv/kraken/channels/$twitch_name";
if ( file_get_contents($jsonurl) ) {
$json = json_decode(file_get_contents($jsonurl), true);
//....
}
}
}
Am I supposed to add a client ID to requests like this? How do I do that in PHP? Thank you