Peter Peter - 5 months ago 38
Apache Configuration Question

cURL request work fine on server but wont work on my localhost:8080

I create a process that log me in my account of It work like a charm when I put it on my FTP.

This is the problem :

I have an apache local server set on my machine (easyPHP) on localhost:8080.
I have also an IIS server set on my machine at the port --> localhost:80.

My cURL request don't work. This is my code:

$lien = '';
$postfields = array(
'username' => 'xxx',
'password' => 'xxx'

$path_cookie = 'connexion.txt';
if (!file_exists(realpath($path_cookie))) touch($path_cookie);

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $lien);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));

$return = curl_exec($curl);
echo 'error:' . curl_error($curl);

Firstly: Yes I have cURL install on my server, I did some other cURL request between my apache server and my IIS server and everything work fine.

Secondly: The file "connexion.txt" is well create, BUT empty.

Thirdly: The echo of ($return) response nothing, and on my server the response is "Object moved to here."

Fourthly: Yes i read this topic, but didn't help me a lot..

cURL not working

Finally: When I try to debug the cURL request the error is:

error:SSL certificate problem: unable to get local issuer certificate

Can anyone help me please? I'll stay here to answer comment/test/debug/answer etc.

Thanks !


You're most likely not using a certificate at all so either use http or try using

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);