With Client-ID, API calls take 3-5 seconds to load on localhost

I assume the SSL Certificate isn’t getting verified since you had to disable verification to make it work. api.twitch.tv uses a DigiCert SHA2 Secure Server CA certificate which is from the DigiCert Global Root CA.

You can grab the cacert.pem from this site - curl - Extract CA Certs from Mozilla

and switch your 2 lines to this:

curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt ($ch, CURLOPT_CAINFO, “pathto/cacert.pem”);

See if that works for you.

Information taken from: php - HTTPS and SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK - Stack Overflow