Re: usinf ftp
| From: | Kyle Jerviss | Date: | Thu, 07 Dec 2000 17:08:24 +0000 |
| Subject: | Re: usinf ftp | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29162@lists.php.net to get a copy of this message | ||
you could try this:
$fp_i=fopen("ftp://ftp.site.com/download/setup.exe","r");
$fp_o=fopen(/home/php/download/setup.exe","w");
while(!feof($fp_i))fwrite($fp_o,fread($fp_i,1),1);
alternately, you could use:
$con=ftp_connect("ftp.site.com");
ftp_login($con,"username","password");
ftp_chdir($con,"/download/");
ftp_get($con,"/home/php/download/setup.exe","setup.exe",FTP_BINARY);
There is at least one other way should neither of these work.
PHP Researcher wrote:
>
> Dear Sir/Madam
>
> I want to download a file on a ftp site to my site.
> Suppose that file is ftp://ftp.site.com/download/setup.exe
> I want to download it on my site at the local file (/home/php/download/)
>
> I want to write the script on the /home/php/download/ but
> i do not know the steps to ftp a file with PHP
>
> Can you help me?
>
> ------------------------------------------------------------
> Buy Iranian Music at :
> -> http://www.IranMelody.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net