cURL https problem - help needed

Discussion in 'PHP' started by highway7, Feb 12, 2010.

  1. #1
    Hi,

    I am attepmting to send info to a secure https site using cURL. When I try to do so though, I receive the following error:

    7 couldn't connect to host
    PHP:


    I am including the following SSL info:

    // SSL info
    curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($handle, CURLOPT_CAINFO, "https://www.tt2.co.uk/gateway/includes/intermediate.crt");
    PHP:


    so shouldnt really be getting an error. Does anybody know why this is?

    All help is appreciated.

    Thanks.
     
    highway7, Feb 12, 2010 IP
  2. systematical

    systematical Peon

    Messages:
    81
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is all you should need to do:

    
    		$ch = curl_init(); /// initialize a cURL session
    		curl_setopt ($ch, CURLOPT_URL,"https://foo.com");
    		curl_setopt ($ch, CURLOPT_HEADER, 0);
    		curl_setopt($ch, CURLOPT_POST, 1); 
    		curl_setopt($ch, CURLOPT_POSTFIELDS, "$rssData");
    		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt ($ch, CURLOPT_POSTFIELDSIZE, 0);
    		curl_setopt ($ch, CURLOPT_TIMEOUT, 360);
    		$datastream = curl_exec ($ch);
    		curl_close ($ch); /// close the curl session
    
    Code (markup):
    You don't need to tell cURL its HTTPS, the server your posting to should handle that as long as the CURLOPT_URL is https
     
    systematical, Feb 12, 2010 IP