You must change the following
- Send
game_idinstead ofgame
Get the game ID for your game here:
- Send the client ID as a header not as a query string
In PHP this is via setting a Header as a curl option
https://www.php.net/curl_setopt
CURLOPT_HTTPHEADERAn array of HTTP header fields to set, in the formatarray('Content-type: text/plain', 'Content-length: 100')
So, (incomplete code snippet):
$ch = curl_init('https://api.twitch.tv/helix/streams?game_id=123');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Client-ID: YourClientID'));
For example