Using file_ get_ Contents() error: failed to open stream: http request failed!
Reason 1: the URL parameter value has no URL encoding
use URLEncode ($VAL) to code the parameter value. Note that the parameter value code> is used
Reason 2: there are spaces in the URL
$url = preg_ replace("/ /", "%20", $url); // Replace spaces with% 20 code> with regular
Reason 3: configuration problem (modified) php.ini , and restart the server)
Allow_ url_ Fopen is enabled,
to allow_ url_ fopen = On
allow_ url_ Fopen = on (indicates that the remote file can be opened through URL) code>
user_ Agent = "PHP" (which script is used to access the network. By default, there is a ";" Remove it.) Restart the server.
There may be a warning message. If you want to use the perfect solution, you still need to set it php.ini User in it_ Agent, the default user_ Agent is PHP, change it to Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
user_ agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
- Complete failure: http request failed!
- failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
- Unable to open thread: http request failed! (4 pesos, PHP 4)
- file_get_Contents and fopen return false when requesting HTTPS address: Error content: SSL routes: ssl3_get_server_certificate:certificate verify failed
- Server returned HTTP response code: 500 for URL xxxxxxxxxxxxx
- [Solved] Wget: Unable to establish SSL connection
- How to Solve Python Error: “HTTP Error 403: Forbidden”
- [How to]docker http: server gave HTTP response to HTTPS client
- scp:not a regular file
- How to Solve Error makefile:3: *** missing separator. Stop.