Re: Reading a file from another server
| From: | Thomas | Date: | Fri, 25 Jul 2003 22:33:19 +0000 |
| Subject: | Re: Reading a file from another server | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156949@lists.php.net to get a copy of this message | ||
if I use:
readfile("ftp://username:password@server.somedomain.com/test.txt");
It doesn't have any errors and comes up blank.
If I put:
$result =
readfile("ftp://username:password@server.somedomain.com/test.txt");
print ($result);
it ends up showing a '0' by iteself. that's it. and I knwo the txt file
is full of info.
I'm stumped again.
Cheers. for your help.
Thomas
"Chris Shiflett" <shiflett@php.net> wrote in message
news:20030725220526.27638.qmail@web14305.mail.yahoo.com...
> --- Thomas <zaxisnet@hotmail.com> wrote:
> > I'm having problems creating code to read a file from another
> > server.
> >
> > 1. Is this even possible? with a secure server aswell?
>
> Yes.
>
> > this is my code:
> > <?php
> > $filename =
> > "http://www.domain.com/test.txt";
> > $handle = fopen ($filename, "r");
> > $content = fread($handle, filesize ($filename));
> > fclose($handle);
> > echo $content;
> > ?>
>
> This code can be replaced with:
>
> readfile('http://www.domain.com/test.txt');
>
> As far as debugging problems related to this, check your php.ini and make
sure
> the URL wrapper is enabled. Otherwise, you will be restricted to your
local
> filesystem only.
>
> Hope that helps.
>
> Chris
>
> =====
> Become a better Web developer with the HTTP Developer's Handbook
> http://httphandbook.org/