I'm using the following code to get the output of a https site.
That site also needs an ssl certificate: tpa1266.pem.
I have the certificate in the same directory that I'm running the php script.
When I execute the PHP script I get the error: "unable to set certificate file (wrong password?)"
My certificate doesn't have a password. I created the certificate using the options -nodes.
If I go to a DOS prompt and I type
curl -v -o output.txt -E tpa1266.pem [url]http://[/url] ......
It works!!
So,
any ideia of what's wrong in my PHP code ???
<?php
$url = "https://cer.pnet.multibanco.pt/pvtn?A030=M001&A001=1266&C007=&C013=&A061=&A105=9782&B1=Submit/";
$cert = "tpa1266.pem";
$ch = curl_init ($url);
$fp = fopen ("output.txt", "w");
curl_setopt ($ch, CURLOPT_SSLCERT, $cert);
curl_setopt ($ch, CURLOPT_SSLCERTPASSWD, "");
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
// Error handling
echo curl_error($ch);
curl_close ($ch);
fclose ($fp);
?>