Re: [PHP] FTP info in a variable
The list has definitely been quite funky last night and today... Steve Buehler wrote: original message 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? You might be able to do something with named pipes and/or exec and redirect and a little helper PHP script that takes STDIN as an open stream and passes that to http://php.net/ftp_fput I think you'd get better performance and a lot less headache just using a tmp file, though. -- 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
Re: [PHP] FTP info in a variable
At 11:07 AM 2/25/2005, you wrote: Steve Buehler wrote: 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? What you just described is pretty much the entire PURPOSE of http://php.net/manual/en/ref.ftp.php Now that you know that, re-read that, and you'll realize just how easy this is gonna be. :-) PS You may find it easier to go ahead and use a local temporary file, just to use fputcsv() instead of rolling your own. Or not, as rolling your own CSV writer isn't exactly rocket science. Maybe I missed it the second time through, but I still can't find anything that makes that the entire PURPOSE of what you referred too. Like I said, I might have missed it though, that one is for ftping a file. What I was hoping for is to NOT have to create the file locally first before uploading it. Right after sending this email, I was looking for something else and found out that fopen is what I was looking for. I still have to use the ref.ftp.php ftp functions to delete the file on the remote server first though because fopen can not open an existing file on a remote server, zero it out and then write to it and it can't just delete a remote file.that I know of. So I have to delete it first with the ftp functions, then ftp it over from the variable into a remote file. At least I don't have to create a temporary file on the local server first. That is what I was really trying to avoid. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP info in a variable
Steve Buehler wrote: 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? What you just described is pretty much the entire PURPOSE of http://php.net/manual/en/ref.ftp.php Now that you know that, re-read that, and you'll realize just how easy this is gonna be. :-) PS You may find it easier to go ahead and use a local temporary file, just to use fputcsv() instead of rolling your own. Or not, as rolling your own CSV writer isn't exactly rocket science. -- 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
RE: [PHP] FTP info in a variable
Yes i think you can but i really won't do that. It does depend on the server and php verison that is installed on the server. From: Steve Buehler [EMAIL PROTECTED] To: PHP php-general@lists.php.net Subject: [PHP] FTP info in a variable Date: Thu, 24 Feb 2005 11:19:25 -0600 MIME-Version: 1.0 Received: from lists.php.net ([216.92.131.4]) by MC8-F29.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 25 Feb 2005 08:56:50 -0800 Received: from ([216.92.131.4:22676] helo=lists.php.net)by pb1.pair.com (ecelerity HEAD r(5124)) with SMTPid 39/05-51537-DC85F124 for [EMAIL PROTECTED]; Fri, 25 Feb 2005 11:56:46 -0500 Received: (qmail 50993 invoked by uid 1010); 25 Feb 2005 16:21:52 - Received: (qmail 20808 invoked by uid 1010); 25 Feb 2005 15:49:59 - X-Message-Info: 6sSXyD95QpUypKMHi+vQyQhgpFDWBX43dtyZ3S9x9rA= Return-Path: [EMAIL PROTECTED] X-Host-Fingerprint: 216.92.131.4 lists.php.net Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] X-Host-Fingerprint: 66.163.170.83 smtp813.mail.sc5.yahoo.com X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 X-OriginalArrivalTime: 25 Feb 2005 16:56:50.0514 (UTC) FILETIME=[FFF46320:01C51B5A] 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? Thanks Steve -- 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