View Full Version : get_headers() alternative in php4

11-06-2007, 06:53 AM
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.

11-06-2007, 08:20 AM
If you want to check whether file exist simply use

//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

11-06-2007, 09:33 AM
Thanks for helping me. I will try to figure it out.

11-06-2007, 03:56 PM
Solution: Update to PHP5.

11-07-2007, 12:17 AM
or simply use the appropriate PHP4 functions

echo '<pre>';

to check if a url exists you could use fsockopen() (http://www.php.net/fsockopen)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum