PHP disable ssl certificate validation

raw

README.txt

Do this ONLY if the server's certificate is invalid.
raw

code.php

1
2
3
$ctx = stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]);
$res = file_get_contents("https://example.org", false, $ctx);
 
Christian Weiske Christian Weiske
owner

History