php - getting https site through curl


I need to get information from https site, it has http authentication, i did some research and i know that i need to use curl so there is my code

$ch = curl_init();
$url = 'https:/....';
$username ='user';
$password ='userspassword';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSLCERT, '/var/www/cert/ows.pem');
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, ' ');
curl_setopt($ch, CURLOPT_SSLKEY, '/var/www/cert/ssl-cert-snakeoil.pem');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, ' ');

curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSLVERSION,3)

and i get "unable to set private key file: '/var/www/cert/ssl-cert-snakeoil.pem' type PEM58" if i dont use any pem i get empty response from server, if i do i cant load them.. where i can find sslcert and sslkey on my system? and how to format them correcly, becouse if i export them directly from firefox it.

People are also looking for solutions to the problem: php - Sugar returns undefined {"content":" in a pop-up on clicking a menu link


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.