ich dieses Stück Code haben Abfragen mit curl zu starten:php curl: SSL_VERIFYPEER Option hat keine Wirkung
function curl_query($full_url, $username, $password, $payload) {
$additionalHeaders = "";
$process = curl_init($full_url);
curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', $additionalHeaders));
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $payload);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($process, CURLOPT_MAXREDIRS, 4);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, FALSE);
$return = curl_exec($process);
if ($return === false) {
error_log("CURL error ".curl_error($process));
}
return $return;
}
Die Option CURLOPT_SSL_VERIFYPEER auf false gesetzt ist, so kann ich Seiten mit selbstsignierten lesen Zertifikate. Jedoch, wenn ich diesen Code gegen eine https-URL auszuführen, bekomme ich einen Fehler:
CURL error SSL: certificate subject name 'localhost' does not match target host name '192.168.1.1',
ich diesen Code auf einem CentOS 5 Server mit php53 Paket installiert laufen.
Vielen Dank im Voraus
Es hat funktioniert. Ich danke dir sehr. – facha
Sie sind herzlich willkommen! – hek2mgl
Wie offensichtlich. Es gibt sowohl ein 'CURLOPT_SSL_VERIFYHOST' ** als auch ein 'CURLOPT_SSL_VERIFYPEER'. Das habe ich vermisst; Das hat mich gerettet. Vielen Dank! –