If you use file_get_contents directly, an error will be reported;
Copy the code The code is as follows:
$url = (https:// xxx.com");
file_get_contents($url);
Error:
Warning: file_get_contents(https://xxx.com) [function.file-get-contents] : failed to open stream: No such file or directory in D:wampwwwgrabber_clientindex.php on line 3
Using curl is ok:
Copy code The code is as follows:
$url = (https://xxx.com);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$ url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
print_r($result);
?>
The key points are the following two sentences:
Copy the code The code is as follows:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
http://www.bkjia.com/PHPjc/321611.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321611.htmlTechArticleUsing file_get_contents directly will report an error; copy the code as follows: $url = (https://xxx.com" ); file_get_contents($url); Error: Warning: file_get_contents(https://xxx.com) [funct...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn