PHP file_get_contents failed [function.file-get-contents]: Failed to open Stream:http request failed! Resolve

Source: Internet
Author: User

When you use the File_get_contents method to obtain a remote file, you receive

[Function.file-get-contents]: Failed to open stream:http request failed!

Error

The workaround is to modify the Allow_url_fopen = on in php.ini to solve some people's problems,

The perfect solution also modifies the user_agent= "PHP" To change the parameters 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) "

Simulation of the browser can be;

PHP file_get_contents failed [function.file-get-contents]: Failed to open Stream:http request failed! Resolve

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.