我正在尝试获取网址的内容。确切的网址是动态的,但我有网址重定向到数据的最终网址。当我在浏览器中输入此URL时,一切都很好,但是当下面的curl配置没有获得任何数据时。我还能尝试什么?谢谢!
// custom curl to get page content of last redirect
function getCurlContent($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
if ($content===FALSE)
echo curl_error($ch);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
回声输出:
SSL certificate problem: self signed certificate in certificate chainSSL certificate problem: unable to get local issuer certificateSSL certificate problem: self signed certificate in certificate chain