我是否需要此php重定向的证书才能作为i';我期待着呢?

我是否需要此php重定向的证书才能作为i';我期待着呢?,php,redirect,ssl,curl,https,Php,Redirect,Ssl,Curl,Https,当我在浏览器中访问http://www.google.com/时,我被重定向到https://www.google.com/。运行此代码时,我希望CURLINFO\u EFFECTIVE\u URL返回我https: $ch = curl_init('http://google.com/'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_set

当我在浏览器中访问http
://www.google.com/
时,我被重定向到https
://www.google.com/
。运行此代码时,我希望
CURLINFO\u EFFECTIVE\u URL
返回我https

$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);
添加ssl证书和添加以下字段是否会像我所期望的那样起作用

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, 'whateverCrt.crt');

此代码当前返回什么?
curl\u exec($ch)
不返回任何内容(字面上为空),
curlinfou HTTP\u code
返回
200
,以及
curlinfou有效的URL
返回
http://google.com/