After chopping hands, the fraud call came before the express delivery was received. How to improve the privacy and security of e-commerce>>>
When using PHP5’s own file_ get_ When the contents method is used to get remote files, sometimes the file will appear_ get_ contents(): failed to open stream: HTTP request failed! This is a warning message
Google or Baidu, a lot of such problems, the solution is to modify PHP. Ini, allow_ url_ Fopen is enabled and changed to allow_ url_ fopen = On
This can solve some people’s problems. Some people say that in php.ini, there are two options: allow_ url_ Fopen = on (indicates that the remote file can be opened through URL), user_ Agent = “PHP” (indicates which script is used to access the network. By default, there is a “;” Remove it.) Restart the server
However, some of them still have this warning message. If you want to solve it perfectly, you still need to set the user in php.ini_ Agent, PHP’s default user_ The agent is PHP, we changed it to Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) to simulate the browser
user_ agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”
In the work of this problem, after the perfect solution, so share with you
<?php
ini_set("user_agent","Mozilla/4.0(compatible;MSIE5.00;Windows98)");
$data_content=file_get_contents($url);
But the best way is to use curl to grab it. It seems that curl is more powerful
Original address:
Failed to open stream: http request failed( file_ get_ (caused by contents)
Label:
php
file_ get_ contents
failed
Intelligent recommendation
php Only variables can be passed by reference
ntpdate[16603]: the NTP socket is in use
How to view the source code of Google Chrome plug-in
Learn more about PHP opcode caching
[No.5 ionic] modify the application name, icon and start interface
Similar Posts:
- Complete failure: http request failed!
- failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
- file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
- Server returned HTTP response code: 500 for URL xxxxxxxxxxxxx
- Interface automation (8): an error is reported during interface testing sslerror: Certificate verify failed
- How to Solve Python Error: “HTTP Error 403: Forbidden”
- file_get_Contents and fopen return false when requesting HTTPS address: Error content: SSL routes: ssl3_get_server_certificate:certificate verify failed
- [Solved] Wget: Unable to establish SSL connection
- How to Solve Error: Heartbeating to master:7182 failed.
- [Solved] remote: HTTP Basic: Access denied Authentication failed for ‘https://’