Do i need a cert for this php redirect to work as i'm expecting it to? -
when access http://www.google.com/ in browser i'm redirected https://www.google.com/. i'm expecting curlinfo_effective_url return me https when running code:
$ch = curl_init('http://google.com/'); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_useragent, "mozilla/4.0 (compatible; msie 5.01; windows nt 5.0)"); curl_setopt($ch, curlopt_nobody, true); echo curl_exec($ch); // echos nothing echo curl_getinfo($ch, curlinfo_http_code); // echos '200' echo curl_getinfo($ch, curlinfo_effective_url); // echos 'http://google.com/' curl_close($ch); will adding ssl cert , adding following fields make work i'm expecting?
curl_setopt($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_cainfo, 'whatevercrt.crt');
Comments
Post a Comment