Using Curl to post data to SSL

Hello,

I am trying to post data to a SSL domain using following code:


$URL = "https://myurl:443";
 
            $ch = curl_init($URL);
            
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);     
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);  
            if(curl_exec($ch)){
               echo "yes"; 
            }else{
               echo "No"; 
            }

But, it always echoes no, i.e, curl_exec doesn’t work. I can’t use cert file like here:

curl_setopt($tuCurl, CURLOPT_CAINFO, getcwd() . “/ca.pem”); //from php manual

because i haven’t got one, however SSL certificate is installed. Please suggest me a way to get it done!

Does anyone know the meaning of this error:

SSL read: error:00000000:lib(0):func(0):reason(0), errno 104

the server may have some sort of protection in place if there is no referrer or user agent specified.

try setting both CURLOPT_REFERER and CURLOPT_USERAGENT with curl_setopt()