php - Code does not work without disabling SSL -
please take @ code:
<?php $url = "the_source_url"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt ($ch, curlopt_ssl_verifypeer, false); $result = curl_exec($ch); print_r($result); ?>
this page accessed android app date source. url
returns json data, print back, then, in app, process data , display it. working fine me right (i'm still in testing phase).
i read in disabling ssl
(whih did in line 6) risky , not recommended. however, couldn't make script work unless disable it.
how make work without disabling ssl? or how eliminate risk?
disabling certificate make vulnerable man in middle attack, can download use certificate
curl_setopt ($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt ($ch, curlopt_cainfo, "path_to_certificate/cert.pem");
to certificate follow guide
then click on “view certificate”:
bring “details” tab of cerficates page, , select certificate @ top of hierarchy. ca certificate.
then click “export”, , save ca certificate selected location, making sure select x.509 certificate (pem) save type/format.
Comments
Post a Comment