Adding Client ID in header in PHP?

$ch = curl_init('https://api.twitch.tv/kraken/channels/' . $twitch_name);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Client-ID: ' . $YOURID,
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$r = curl_exec($ch);
$i = curl_getinfo($ch);
curl_close($ch);

if ($i['http_code'] == 200) {
    $json = json_decode($r);
} else {
    echo 'Failed';
}
1 Like