This article uses two methods to solve the error of grabbing the https address in the file_get_contents function in PHP. Friends in need can refer to the following
Method 1:
In PHP, When crawling https websites, the following error content is prompted:
Warning: file_get_contents() [function.file-get-contents]: failed to open stream: Invalid argument in I:Webmyphpa.php on line 16
Open the php.ini file and find;extension=php_openssl.dll, remove the double quotes ";", and restart the web server.
For the Apache server, you can enable mod_ssl module testing at the same time.
If it is inconvenient to modify the server configuration, you can refer to the following function to solve the problem:
Code example:
Copy after login
Method 2:
In PHP, when using the file_get_contents function to capture the content of a website whose URL starts with https, an error warning similar to the following will appear:
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 and find;extension=php_openssl.dll, remove the double quotes ";", and restart the web server.
Apache can enable the mod_ssl module test at the same time
The above content has shared with you two methods to solve the error of grabbing the https address in the file_get_contents function in PHP. I hope it will be helpful to everyone.
Related recommendations:
Header usage and basic functions in PHP
Detailed explanation of count function examples in PHP
Detailed explanation on the usage of spl_autoload_register() function in PHP
##
The above is the detailed content of Solution to the error in grabbing https address by file_get_contents function in PHP. For more information, please follow other related articles on the PHP Chinese website!