You are here: Re: Stream from FTP directly to MySQL while parsing CSV « PHP Programming Language « IT news, forums, messages
Re: Stream from FTP directly to MySQL while parsing CSV

Posted by Chung Leong on 01/27/06 03:13

Eric Anderson wrote:
> I have some files that sit on a FTP server. These files contain data
> stored in a tab-separated format. I need to download these files and
> insert/update them in a MySQL database. My current basic strategy is to
> do the following:
>
> 1) Login to the ftp server using the FTP library in PHP
> 2) Create a variable that acts like a file handle using Stream_Var in PEAR.
> 3) Use ftp_fget() to read a remote file into this variable (this is so I
> don't have to write it to disk).
> 4) Parse that data now stored in memory using fgetcsv() (again treating
> that variable as a file handle using Stream_Var). This produces an array.
> 4) Insert/Update the data in the array using DB in PEAR.

Is there a reason why you can't use the built-in FTP stream wrapper?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация