TyForHelpDude
TyForHelpDude

Reputation: 5002

php curl request always return false

I prepared a url with user credentials to validate client and return the file I post it with curl in php 5.6.13 within this code piece:

$url ="https://192.168.0.15:10445/wfmi/Infrastructure/getFile.php?filenamecentraldb=".$_GET["filename"]."&username=administrator&password=passwordofadmin";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);

But response is always false..

I run ch_error($ch) and it returns

"Peer certificate cannot be authenticated with known CA certificates" what does this mean ?

Here is the target page:

if(isset($_GET["filenamecentraldb"]))
{
    error_log("Check1");//never reach there...
    try
    {
        $username = $_GET["username"];
        $password = $_GET["password"];
        ...
        exit(0);
    }
    catch (PDOException $e)
    {
        echo "Error ocurred:".$e->getMessage();
        exit(0);
    }
    catch (Exception $e)
    {
        echo "Error ocurred:".$e->getMessage();
        exit(0);
    }
}

Upvotes: 1

Views: 2184

Answers (1)

Alex Tartan
Alex Tartan

Reputation: 6826

Since you're using private IPs and (most likely a dummy ssl certificate), you need to disable ssl verification for your requests.

 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

But be aware that this is a security risk. So avoid this in a production environment

Upvotes: 3

Related Questions