Re: FileExists?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gustav Wiberg wrote:

----- Original Message ----- From: "M" <lists@xxxxxxxxxxxxxx>
To: "Gustav Wiberg" <gustav@xxxxxxxxxxxxxx>
Sent: Monday, November 07, 2005 11:12 PM
Subject: Re:  FileExists?


Gustav Wiberg wrote:

Hi there!

File_exists doesn't seem to work with URLs that point to another domain. What to use?

$x = fopen(http://www.stammis.com/getstart.php);
if file_exists($x) ....
....
????



file_exists() takes filename as parameter, not file pointer.

besides, spare the one http request and use @fopen() (@ will suppress eventual warning), it will speed up your script.


I tested to use @fopen instead of fopen and it took 1 second longer...


I meant using:

if(($x = @fopen('http://www.stammis.com/getstart.php')) !== false) {

}

instead of:

if(file_exists('http://www.stammis.com/getstart.php')) {
    $x = fopen('http://www.stammis.com/getstart.php');

}

And you need to check the speed more than once.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux