[英]I am trying to open a https site , using curl in php . But I am getting a blank page
I am trying to open a https site , using curl in php . 我试图打开一个https网站,在PHP中使用curl。 But I am getting a blank page .Though when i checked I can find that the httpcode returned is 200. I am able to open the same page using the browser .
但是我得到一个空白页面。虽然我检查过,但我发现返回的httpcode是200.我可以使用浏览器打开同一页面。 I have disbaled the ssl verifyer and ssl_verify host since the host name and the name in the certifcate was different .
我已经废除了ssl verifyer和ssl_verify主机,因为主机名和certifcate中的名称不同。
Here is my code any help would be useful 这是我的代码,任何帮助都会有用
<?php
$url = "https://abcde.com/";
$ch = curl_init($url);
echo "init";
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 200);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERPWD,"uname:pwd");
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,1);
$curl_scraped_page= curl_exec($ch);
$httpCode=curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(!$curl_scraped_page)
{
echo "first learn";
}
echo $httpCode ;
echo $curl_scraped_page;
curl_close($ch);
?>
Try using CURLOPT_USERAGENT to set the user agent to the same one your browser uses. 尝试使用CURLOPT_USERAGENT将用户代理设置为浏览器使用的用户代理。 They may be using user agent sniffing.
他们可能正在使用用户代理嗅探。
设置此选项:
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.