Re: [suspicious - maybe spam] [PHP] How to access remote files with php?

From: Date: Wed, 19 Jan 2005 16:54:36 +0000
Subject: Re: [suspicious - maybe spam] [PHP] How to access remote files with php?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206765@lists.php.net to get a copy of this message
Sephiroth wrote: > Hi all, > > How to access remote files with php? > For ex: > $sFile = "http://www.php.net/123.txt"; > if (file_exists($sFile)) { > $hFile = fopen($sFile); > ... > fclose($hFile); > } At the risk of being accused of copying whatshisname... "Yes." :-) You're pretty much written the code in its most simple form the way it should be, and it should work as-is. You'd want to add in some error-checking code so your application does something reasonable when the file isn't found, or the network connection flakes out, or... PS file_exists() may only work for URLs in recent versions of PHP... Read the manual to find out which versions. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#206765) next »