I am having issues with setting the OAuth
has a header, but seems to work fine when it is inline…
This code does not work:
$url = "https://api.twitch.tv/kraken/users/" .$_SESSION['user']['name']. "/subscriptions/trumpsc";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 'Accept: application/vnd.twitchtv.v3+json');
curl_setopt($ch, CURLOPT_HEADER, 'Authorization: OAuth ' .$_SESSION['user']['token']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
This code does work:
$url = "https://api.twitch.tv/kraken/users/" .$_SESSION['user']['name']. "/subscriptions/trumpsc?oauth_token=" .$_SESSION['user']['token'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 'Accept: application/vnd.twitchtv.v3+json');
//curl_setopt($ch, CURLOPT_HEADER, 'Authorization: OAuth ' .$_SESSION['user']['token']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
What am I doing wrong? Can someone explain?