getting specific data from file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yaron
Forum Contributor
Posts: 157
Joined: Fri Aug 22, 2003 8:40 am

getting specific data from file

Post by yaron »

Hello all,
my program goal is to get info from text files and store it in db (mysql)
my input (the text file) is build like an xml file with tags.
a lot of line which looks like that.

<tagName name="parameterName" value="value" status="status" bla bla>

I need to write a script that will go line by line and first identify that the line is relevant (looks like I wrote)
then I have to get only the parameterName the value and the status (for storing).
So once I read the line I need to isolate this three elements.

I know how to open the file and read from it but can get the infromation I want. which functions can help me?
I hope the Q is understood
Thanks
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

Well, this isn't really a tough one. You just need to familiarize yourself with the php manual. Perhaps a little stristr and regex in there and you should be fine. Don't forget to also check out the file function if all of these entries are on their own line.

Cheers,
BDKR
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i suggest looking up preg_split. it should help in getting the relevant lines.
then use it again on the lines that are relevant to get the data
Post Reply