...

View Full Version : get_headers() alternative in php4



developer
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.

gunman
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

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

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

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


<?
echo '<pre>';
print_r(apache_request_headers());
print_r(apache_response_headers());
?>

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