So I used twitch validate to confirm that my token is valid…
$streamurl = "https://api.twitch.tv/helix/streams?user_login=<login_name>";
function file_get_channelcontents_curl($streamurl) {
$streamch = curl_init();
curl_setopt($streamch, CURLOPT_URL, $streamurl);
curl_setopt($streamch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($streamch, CURLOPT_CUSTOMREQUEST, 'GET');
$streamheaders = array();
$streamheaders[] = 'Client-Id: <client-id-here>, Authorization: OAuth <oauth-here>';
curl_setopt($streamch, CURLOPT_HTTPHEADER, $streamheaders);
$streamresult = curl_exec($streamch);
if (curl_errno($streamch)) {
echo 'Error:' . curl_error($streamch);
}
curl_close($streamch);
return $streamresult;
}
echo file_get_channelcontents_curl($streamurl);
And I get:
{“error”:“Unauthorized”,“status”:401,“message”:“OAuth token is missing”}
What am I doing wrong here?