Good stuff Jamie.

Steve, I believe it may even be possible to compress the file on the fly, or
send it using SSL if that is desirable;

http://www.php.net/manual/en/ref.stream.php describes how to use stream
wrappers.

good luck,

Warren Vail

> -----Original Message-----
> From: Jamie Alessio [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 25, 2005 9:13 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: FTP info in a variable
>
>
> > I have to write a little program that pulls information from a
> > database, formats it into csv format for importing into excel and ftps
> > it to another server.  I have everything worked out except for the
> > ftping.  I have read through http://us4.php.net/manual/en/ref.ftp.php
> > and I know I can get the data from the database, save it to a file and
> > ftp it.  Does anybody know if I can skip the step of saving it
> to a file
> > and ftp/stream it directly to a filename on another server?
> >
> Steve,
> You should be able to skip the step of writing the CSV file out to disk
> by using PHP's Filsystem functions along with FTP wrappers. I think
> something like this will work:
>
> $handle = fopen("ftp://user:[EMAIL PROTECTED]/somefile.csv", "w");
> fwrite($handle, $yourCSVdata);
>
> The FTP wrappers allow you to (almost) treat the file as though it were
> on your local filesystem.
>
> Check the man pages for details on how to do this properly and check for
> errors:
> http://us4.php.net/manual/en/function.fopen.php
> http://us4.php.net/manual/en/function.fwrite.php
> http://us4.php.net/manual/en/wrappers.ftp.php
>
> - Jamie
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to