curl-and-php
curl and PHP
Date: Tue, 23 Oct 2001 14:28:50 +0100
hi
I'm using php 4.0.6 and windows 2k Server.
I need to run a script remotely in a HTTPS address that requires me to autenticate with a certificate.
I have the PEM certificate in the same dir as the script.
This is my code.
<?
$ch=curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$params");
curl_setopt($ch,CURLOPT_VERBOSE,1);
curl_setopt ($ch, CURLOPT_POSTFIELDSIZE, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 360);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch,CURLOPT_SSLCERT,"multicert.pem");
curl_setopt($ch,CURLOPT_SSLCERTPASSWD,"3I3I37RP52G1L15D8T8S");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
echo "<p>$data</p>";
$info=curl_getinfo($ch);
while(list($key,$value)=each($info))
echo "<p>$key=$value</p>";
curl_close($ch);
?>
and my output is:
url=https://cer.pnet.multibanco.pt/pvtn
http_code=0
header_size=0
request_size=0
filetime=0
total_time=0
namelookup_time=0.02
connect_time=0
pretransfer_time=0
size_upload=0
size_download=0
speed_download=0
speed_upload=0
DATA: O seu pagamento foi recusado.
* Your connection is using a weak random seed! * Closing live connection (#0)
----------------------------------------------------------------
If i call any http address everything works well, but when i try to call a https server, even without certificate request ... it doesn't return nothing.
Can anyone help me out?
Hugo Alexandre Dias
Web-Programmer
MNI - Médicos na Internet
E-mail: hugo_at_mni.pt
ICQ # 7995052
http://www.mni.pt
http://www.saudenainternet.pt
http://www.listamedica.com
http://medicos24.siconline.pt
MNI - Um Mundo de Médicos
- application/x-pkcs7-signature attachment: smime.p7s