Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    get_headers() alternative in php4

    I want to check a file on my server root directory. I have to give a full URL in the path. The file_exists() do not work with this, get_headers() function is in php5. Can anyone suggest an alternative.

  • #2
    New Coder
    Join Date
    Jul 2005
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you want to check whether file exist simply use

    Code:
    //file to check if exist
    $file = 'File Name';
    if (file_exists(dirname(__FILE__).'/'.$file))
    {
    //file exist do whatever you want
    }
    To work in your case just save that code somewhere in your root directory and run it
    If you can not find a decision, maybe you have to try to change a problem

    http://www.gunman.co.nr
    http://bglinux.org

  • #3
    New Coder
    Join Date
    Jul 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for helping me. I will try to figure it out.

  • #4
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Solution: Update to PHP5.

  • #5
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,043
    Thanks
    10
    Thanked 93 Times in 91 Posts
    or simply use the appropriate PHP4 functions
    PHP Code:
    <?
    echo '<pre>';
    print_r(apache_request_headers());
    print_r(apache_response_headers());
    ?>
    to check if a url exists you could use fsockopen()
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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