Force IPv4 in cURL in PHP application Force IPv4 in cURL in PHP application curl curl

Force IPv4 in cURL in PHP application


Please try this code, with curl_setopt
This will force the IPV4 resolving.

if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){   curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);}

the defined insure that the global constants available on your PHP version.