Jump to content

import file using php script


Miko

Recommended Posts

hello,

 

a friend of mine asked that I could create a php script which can import a text file with data content build up like this:

 

FR|01220||S293|GCHRF,GEAFR,GEDOM||D041|0448|0|V25|37|
FR|01220||S314|CBE,CES,CNL,CRU,GCHRF,GEAFR,GEDOM||D041|0448|7|V25|37|
FR|01220||S882|||D041|0448|7|V25|37|
FR|01220||S327328|||D016|1074|3|1|37|
FR|01220||S299,S302303|CBE,CES,CNL,CRU,GCHRF,GEAFR,GEDOM||D041|0448|0|V25|37|
FR|01220||S179180,S182183,S801807,S838839,S842,S845,S874875|||D041|0448|7|V25|37|
FR|01230|||||D041|0448|0|V14|37|
FR|01230|||CIT,GEXAP||D016|1069|3|3|37|
FR|01230||S293|GCHRF,GEAFR,GEDOM||D041|0448|0|V14|37|
FR|01230||S314|CBE,CES,CNL,CRU,GCHRF,GEAFR,GEDOM||D041|0448|7|V14|37|
FR|01230||S882|||D041|0448|7|V14|37|
FR|01230||S327328|||D016|1069|3|3|37|
FR|01230||S299,S302303|CBE,CES,CNL,CRU,GCHRF,GEAFR,GEDOM||D041|0448|0|V14|37|
FR|01230||S179180,S182183,S801807,S838839,S842,S845,S874875|||D041|0448|7|V14|37|
FR|01240|||||D041|0435|5|P20|37|
FR|01240|||CIT,GEXAP||D016|1069|3|110|37|
FR|01240||S293|GCHRF,GEAFR,GEDOM||D041|0435|0|P20|37|

 

I know that I could use an explode('|', $var) etc etc ..

 

But how can I read in the file and tell to my script that he needs to read in the file so that I can explode the variables etc .??

Is it something like fread(filename) ?

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/167268-import-file-using-php-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.