method One:
In PHP, crawl HTTPS web site, prompting the following error content:
Warning:file_get_contents () [function.file-get-contents]: Failed to open stream:invalid argument in i:webmyphpa.php on L INE 16
Open the php.ini file to find; Extension=php_openssl.dll, remove the double quotation mark ";" and restart the Web server.
Apache server, you can enable the Mod_ssl module test at the same time.
If it is not convenient to modify the server configuration, you can refer to the following functions to solve:
code example:
<?php//file_get_contents Crawl HTTPS address contents function Getcurl ($url) {$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, curlopt_returntransfer,1); curl_setopt ($ch, Curlopt_ssl_verifypeer, false); curl_setopt ($ch, Curlopt_ssl_verifyhost, false); $result = Curl_exec ($ch); Curl_close ($ch); return $result;}
Method Two:
In PHP, when you use the File_get_contents function to crawl Web page content with URLs that begin with HTTPS, you receive an error warning similar to the following:
Warning:file_get_contents (https://127.0.0.1/index.php) [function.file-get-contents]: failed to open stream:invalid Argument in E:\website\blog\test.php on line 25
Open php.ini Find, Extension=php_openssl.dll, remove the double quotation mark ";", restart the Web server.
Apache can enable Mod_ssl module testing at the same time
The above content to share two ways to solve PHP file_get_contents function crawl HTTPS address error, we hope to help.