As 3v said.
You should not be using curl, you are supposed to redirect or provide a link for the user to click on, you don’t fetch the page using curl.
Step 1 as documented here:
Is NOT an instruction to perform a curl request. you either place the https://id.twitch.tv/oauth2/authorize inside a a href:
<a href="https://id.twitch.tv/oauth2/authorize?RestOfLink">Login</a>
Or behind something like
<a href="/login/">Login</a>
And the login page does a
<?php
header('Location: https://id.twitch.tv/oauth2/authorize?RestOfLink');
There should be no activity performed for step one of oAuth via cURL