Get Stream Information with Access Token

Hi,

I used this code for getting information about my stream (without the Authorization line). since May you need app access token, so I generated the token and I changed my code but I don’t get informations anymore:

$clientid = 'MY_CLIENT_ID';

$headers = [
	'Client-ID: '.$clientid.'',
	'Authorization: Bearer MY_ACCESS_TOKEN',
];
$handle = curl_init('https://api.Twitch.tv/helix/streams?user_login=MY_USERNAME');
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($handle);

echo $response;

I just get:

{"data":[],"pagination":{}}

whats wrong ?

An empty data array means the stream is offline. Or if you have just gone live, it can take several minutes before the API will show you’re live due to caching.

1 Like

ups thanks it works

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.