Twitch api cURL php return Invalid OAuth token error

You need to use a token. Not a Client Secret.

For the code you are presented a Client Credentials/App Access Token Suffices

Here is a PHP code example for token generation