Php:file_get_contents failed to open Stream:http request failed

Source: Internet
Author: User

Create a new test.php


  
   

Then visit test.php, the result error is as follows:

Warning:file_get_contents (http://test1.xiaoci.com/create.php) [function.file-get-contents]: failed to open stream: HTTP Request failed! http/1.1 404 Not Found in J:\wamp\www\long\wwwroot\mytools\test\test1.php on line 3

Note: http://test1.xiaoci.com a virtual host that I built locally
A virtual host is built locally with the following configuration information:
Http-vhost.conf


  
   
    
       DocumentRoot "d:/wamp/www/"    ServerName test1.xiaoci.com 
  
   

Hosts

127.0.0.1       test1.com127.0.0.1               test1.xiaoci.com

and set 404 to return to index.php, so when http://test1.xiaoci.com/create.php the URL is manually opened from the browser, because create.php is a page that does not exist, it will go to index.php and then be processed in index.php.
Manual open ("http://test1.xiaoci.com/create.php") Condition: can be accessed normally
Usage file_get_contents("http://test1.xiaoci.com/create.php") : reported 404 error

Reply content:

Create a new test.php


  
   

Then visit test.php, the result error is as follows:

Warning:file_get_contents (http://test1.xiaoci.com/create.php) [function.file-get-contents]: failed to open stream: HTTP Request failed! http/1.1 404 Not Found in J:\wamp\www\long\wwwroot\mytools\test\test1.php on line 3

Note: http://test1.xiaoci.com a virtual host that I built locally
A virtual host is built locally with the following configuration information:
Http-vhost.conf


  
   
    
       DocumentRoot "d:/wamp/www/"    ServerName test1.xiaoci.com 
  
   

Hosts

127.0.0.1       test1.com127.0.0.1               test1.xiaoci.com

and set 404 to return to index.php, so when http://test1.xiaoci.com/create.php the URL is manually opened from the browser, because create.php is a page that does not exist, it will go to index.php and then be processed in index.php.
Manual open ("http://test1.xiaoci.com/create.php") Condition: can be accessed normally
Usage file_get_contents("http://test1.xiaoci.com/create.php") : reported 404 error

Is host not supposed to be

127.0.0.1 Test1. Xiaoci. Com

, I looked at the network of the Web site is really 404, visual inspection is you poke to the outside network, host did not pocket

  • Related Article

    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.