Twitch api cURL php return Invalid OAuth token error

Got it, I have uploaded the config.php and generate_and_maintain_token.php, and I edited the config with the app client id and secret, but when trying to access my localhost http://localhost/twitch/generate_and_maintain_token.php to generate token it give me that error:

Failed with 0

See the screenshot, I tried also with terminal.
generate token error

How to fix it please?