Unable to open thread: http request failed! (4 pesos, PHP 4)

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: