cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: exec("curl https://www..sitename.com") returns empty string in php 4 or 5

From: Aleksandar Sabotinov <alex_syscoset_at_yahoo.com>
Date: Mon, 19 May 2008 01:33:50 -0700 (PDT)

I have solved the problem by adding the -k switch for the sites that does not require client certificates. But for the sites that require client certificates I still have a problem, I am trying to use:
   
  $commandConz = "curl -k -E ".PATH_TO_PRIVATE_KEY.":".CERTIFICATE_PASSWORD." ".$url;
$respond = shell_exec($commandConz);
   
  The above code returns empty string.
   
  As for trying with php, I have tried using the following code:
   
  define('CERTIFICATE_PASSWORD', 'somepassword');
define('PATH_TO_PRIVATE_KEY', '/www/somefolder/cert.pem');

      $url = 'https://someurl?someparamter='.urlencode($sign);
            $ch = curl_init();
            $respond = curl_setopt($ch, CURLOPT_URL, $url);
            //$respond = curl_setopt($ch, CURLOPT_HEADER, 0);
            $respond = curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            //$respond = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $respond = curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
            $respond = curl_setopt($ch, CURLOPT_SSLCERT, PATH_TO_PRIVATE_KEY);
            $respond = curl_setopt($ch, CURLOPT_SSLCERTPASSWD, CERTIFICATE_PASSWORD );
            $respond = curl_setopt($ch, CURLOPT_SSLVERSION, 3);
            $respond = curl_exec($ch);
            if(!$respond)
                  echo curl_error($ch);

            curl_close($ch);

When executing this code, I get the error:

error:140943E8:SSL routines:SSL3_READ_BYTES:reason(1000)
What might be the reason for this error?
  

Daniel Stenberg <daniel_at_haxx.se> wrote:
  On Sat, 17 May 2008, Aleksandar Sabotinov wrote:

> $respond = shell_exec("curl https://www.sitename.org?param1=ttt");

Then check the return code from the curl tool. Or since this is the
curl-and-php list, consider using the PHP/CURL binding functions directly...

-- 
Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
       

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-05-19