How to user curl_setopt?
| From: | lhb | Date: | Tue, 07 Feb 2006 08:40:42 +0000 |
| Subject: | How to user curl_setopt? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230036@lists.php.net to get a copy of this message | ||
Hello,
Now I need to use curl to connect to a secure website,
I have three certificates files, two .cer files and one .pfx file.
After I import the certificates into IE browser, the visit is OK.
However, when I use curl_setopt to configure the certificates, it failed.
Can anybody help me?
Thanks.
The code is below:
<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSLCERT,'G:\test\ssl\mes1.cer');
curl_setopt($ch, CURLOPT_SSLCERT,'G:\test\ssl\mes2.cer');
curl_setopt($ch, CURLOPT_SSLKEY, 'G:\test\ssl\xxxx.pfx');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD,'password');
curl_setopt($ch, CURLOPT_URL, $host.$uri);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$returned = curl_exec($ch);
echo $returned;
?>
lhb