SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy failed to open stream: HTTP request failed! HTTP/1.1 404 problem..

    hi, i tried to include a link in my site

    <?php include("http://mysite.com/test.php")?>

    however, it returns an error showing " failed to open stream: HTTP request failed! HTTP/1.1 404 "

    when i tried to access the link directly and from other server, it display correctly.


    May i know how to solved this problem?

    Please help~

    Thank you!
    newbie...

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Don't use URLs with include/require.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh? then how should i make it works?
    newbie...

  4. #4
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried with file_getcontents,

    it still shows

    Warning: file_get_contents(http://............./test.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in http.....
    newbie...

  5. #5
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any idea?
    newbie...

  6. #6
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the file test.php and the file you are including it from, on the same server? If yes, try putting test.php and the other file in the same directory, and try:

    PHP Code:
    <?php include_once('test.php');?>
    By removing the http:// it can fix the problem.

  7. #7
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by digitman View Post
    Is the file test.php and the file you are including it from, on the same server? If yes, try putting test.php and the other file in the same directory, and try:

    PHP Code:
    <?php include_once('test.php');?>
    By removing the http:// it can fix the problem.

    my site is located in /home/httpd/html/running/
    the file is located in /home/httpd/html/forum/test1.php

    how can i solved this? I've been trying many ways.. but still can't get the solution...
    newbie...

  8. #8
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    include '../forum/test1.php'
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  9. #9
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Case 1:
    1) You are trying to include the file, 'test.php' located in html/running

    2) The file you want test.php to be included in, is test1.php, located in html/running/forums

    In this case try this:
    PHP Code:
    <?php include('../test.php');?>
    Case 2:
    You want to include 'test.php' located in html/running/forums, and the file you want test.php to be included in is test1.php, located on html/running.

    In this case try this:
    PHP Code:
    <?php include('forums/test.php');?>
    Let us know what worked.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •