Parsing flat text file(Special functions?)

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
AlexiaES
Forum Newbie
Posts: 2
Joined: Fri Feb 03, 2006 1:44 pm

Parsing flat text file(Special functions?)

Post by AlexiaES »

I'm working on a script that will read data from a flat text file that is generated by Gallery 1.5. The data is arranged much like an array. Simplified example: Album{AlbumItem{Image{Properties}Properties}Properties}
Actual file: http://www.nonamestudios.com/albums/baw/photos.dat
Cut and broken into multiple lines for understanding: http://www.nonamestudios.com/albums/baw ... .dat.split

Is there some PHP functions that would make life simple in parsing that information? I really don't to start building some super complex parsing algorithm and find out one or two functions could have done it.

(Personally I would to just find where in the Gallery script it is doing this, but that has proven to be impossible.)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Just search all the files for the filename of the the file it is writing too. It will be much easier to make it output something like xml that already has functions written for PHP and solid escaping mechanisms, etc..
AlexiaES
Forum Newbie
Posts: 2
Joined: Fri Feb 03, 2006 1:44 pm

Post by AlexiaES »

While it would be great to change it around, I don't have that option. The script has to parse what Gallery gives me.
Anyway, I knew there had to be something, the data if the file was generated by the PHP serialize function, which can be unserialized then. I just have to get it to do it correctly!
Post Reply