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

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

 



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

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