RE: [PHP] "Copying" a file from another server, help?!?
| From: | Boget, Chris | Date: | Fri, 08 Sep 2000 14:55:02 +0000 |
| Subject: | RE: [PHP] "Copying" a file from another server, help?!? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15889@lists.php.net to get a copy of this message | ||
> This works for me:
> <?php
>
> $temparray =
> file("ftp://ramdesigns.com/pub/membership.txt");
> for ($i=0; $i<count($temparray); $i++) {
> // Output results one line at a time or write to file,
> whatever is needed
> echo "$temparray[$i]<br>";
> }
> ?>
In theory, it *should* work for me as well. However, I'm surprised
the above worked for you because without the 'mode' parameter,
I get the error "invalid parameter count". Also, while you are not
logging in as anyone, I must. So my command looks like this:
$fh =
fopen("ftp://user:pass@my.server.com/newsedge_files/newsedge_09-07-2000.zip"
, "r");
In using fopen() with ftp, as I stated in my message of last night,
I get the error "file not found" even though I can take the above
command, past it in IE's address field and get the file. I believe that
the problem is with fopen() and/or the version of PHP I am using
(3.0.5) - one or the other (or both). I've also tried fsockopen() but
encountered problems with it as well.
So I either must find some other PHP functions that can help me
(a search that has thus far proved fruitless) or try to find some other
way I can script ftp... I very much prefer the PHP way if I can help
it.
Chris