Tag: curl

  • PHP cURL error code 60 SSL certificate problem self signed certificate in certificate chain

    Error: When using PHP curl_exec() to a site with https and self signed certificate (which should be likely a staging site, not a production site)

    Error code 60 SSL certificate problem: self signed certificate in certificate chain

    Solution:

    Since it is staging environment, we can completely ignore the certificate verification:

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

  • PHP cURL error code 7 failed to connect

    Error code 7 (CURLE_COULDNT_CONNECT) when calling curl_exec()

    $ch = curl_init("http://www.google.com");    
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($ch);
    print($data); // false
    print(curl_error($ch)); // Failed to connect to www.google.com 80
    print(curl_errno($ch)); // 7
    

    Solution:

    1. Check your internet connection

    2. Check your firewall

    3. Add your proxy if you are connecting through proxy:

    $proxy = “192.168.1.1:8080”;
    curl_setopt($ch, CURLOPT_PROXY, $proxy);