Re: How to user curl_setopt?
| From: | Hybau Leu | Date: | Wed, 08 Feb 2006 03:03:26 +0000 |
| Subject: | Re: How to user curl_setopt? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230063@lists.php.net to get a copy of this message | ||
Thanks for your input.
However, I still can't get it work.
Do you have success examples?
I really don't know how to set the curl options.
I am confusing to the options of CURLOPT_CAINFO, CURLOPT_SSLCERT,
CURLOPT_SSLKEY, etc.
lhb
"James Benson" <jb@jamesbenson.co.uk> wrote in message
news:3E.26.45475.88878E34@pb1.pair.com...
> should it not be:-
> G:\\test\ssl\mes1.cer'
>
> notice how I changed the path to reflect a proper windows drive path!
>
>
> James
>
>
>
>
>
> lhb wrote:
>> 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