Reply to Re: Testing if file exists on a web server

Your name:

Reply:


Posted by Hello on 07/09/05 12:05

No, that function can only be applied to a same server where the script is
being run off, it will not do anything to a remote server.

After thinking a bit, I came up with this code (some parts were removed for
clarity):

$handle = @fopen($url, 'r');
if ($handle===false) { //not on server }
else fclose($handle); //on server

If anyone has any ideas or other ways, I am all ears.

Thanks.


"nemo" <nemo@not_hotmail.com> wrote in message
news:in0vc11pjrl7ajjjal28b7044svqgo3vlm@4ax.com...
> On Sat, 09 Jul 2005 03:27:21 GMT, "Hello" <no-emai@sorry.com> wrote:
>
> >Hello,
> >
> >I am trying to efficiently detect if file exist at the specific URL
> where
> >URL points to a completely different web server than where the script
> is
> >being run at. I need constatnly check for a log file on another server
> and I
> >need my script to detect that file there exists when the script checks
> for
> >it. Right now I have the only way to see if file exists only by
> downloading
> >the whole file with the following piece of code:
> >
> > ob_start();
> > $file = @readfile($url);
> > $contents = ob_get_contents();
> > ob_end_clean();
> >
> >and see if read was empty or not. Problem is that if the log will
> happen to
> >be a few megs then the alarm will be delayes since it will take a few
> mins
> >to download the whole file first. Is there a more efficient way to
> check for
> >existence of the file on the remote webserver without downloading the
> file
> >and checking for the length?
> >
> >I'd take any idea you might have. Thanks.
> >
> Does
> http://uk2.php.net/manual/en/function.file-exists.php
> help?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация