A
A
akimovpro2011-10-24 20:18:54
PHP
akimovpro, 2011-10-24 20:18:54

Receiving mail, parsing an attachment - a CSV file and adding data to the database in PHP. What is the fastest way to do everything?

There is a task to regularly check the mailbox to which reports are sent in CSV format and parse the data into the database. How to make it easier? It is possible to manage only IMAP? Are there lightweight CSV parsing libraries?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
akimovpro, 2011-10-24
@akimovpro

I found an excellent series of materials just on this issue: www.electrictoolbox.com/parsing-google-analytics-data-with-php/

A
Anton_from_Amber, 2011-10-24
@Anton_from_Amber

In PEAR, there are no ready-made parsers: both work with mail, and a parser of everything, and work with a database with the necessary abstraction. If you don't mind of course ;-)

H
homm, 2011-10-24
@homm

> Are there lightweight CSV parsing libraries?
en.php.net/manual/en/function.fgetcsv.php

N
niko83, 2011-10-24
@niko83

MySQL can automatically load CSV files into the database
LOAD DATA INFILE
dev.mysql.com/doc/refman/5.1/en/load-data.html
(didn't use it in practice, check it out)

A
akimovpro, 2011-10-25
@akimovpro

I think I'll try the imap functions and fgetcsv first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question