Portal Home > Knowledgebase > Articles Database > php to read XML


php to read XML




Posted by Lord Northern, 08-25-2007, 10:15 AM
Hey. I was recently trying to learn some file handling in php and so I just wanted to try and write a file driven guest book. I learned the fgets functions and stuff but I was wondering if there was an option to read XML files in php. For example, would there be a function that I could direct to read a specific xml entry? If this is my xml file, would there be a way to directly point to an entry with a specific ID and read everything within the entry? Any info on this would be highly appreciated.

Posted by shackrat, 08-25-2007, 10:29 AM
Take a look at the online help over at php.net. What I think you're looking to use is SimpleXML.

Posted by Lord Northern, 08-25-2007, 10:42 AM
That is exactly what I was looking for Thanks.

Posted by shackrat, 08-25-2007, 10:47 AM
You're welcome. This caught my eye as I recently discovered that for an Ajax project I'm working on. Good luck!

Posted by Jamie Edwards, 08-25-2007, 10:49 AM
You might like to take a look at the XML class(es) in the PEAR library, as they are premade and quite powerful; they save a lot of work.

Posted by Lord Northern, 08-25-2007, 07:17 PM
Which ones exactly?



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Syslog not updated (Views: 710)


Language: