Click to See Complete Forum and Search --> : Php Dom


bals28mjk
07-03-2008, 07:22 AM
Hey.

Has anyone worked with the PHP DOM here? I'm trying to get data from files with .php extensions. It allows for xml, html, but I couldn't find anything for .php extensions.

It's important to note that you are allowed to add html/xml text for the DOM classes in the form of a string. Though, I only know how to get data from asource file with PHP; how would you grab the file after all PHP parsing?

Can someone help me out? What's the best way of going about this? Thanks.

Mr Initial Man
07-03-2008, 10:44 AM
Um... I don't think there is any such thing as the PHP DOM. PHP is simply a programming language used to generate webpages.

Fang
07-03-2008, 11:13 AM
I don't think the extension is of any importance as long as the document is valid xml.

php: dom (http://nl.php.net/dom)

Jeff Mott
07-03-2008, 01:38 PM
bals28mjk, it doesn't matter what the extension is, as long as the file contents is actually XML. You would use the load (http://nl.php.net/manual/en/domdocument.load.php) method like you would for any other file.

NogDog
07-03-2008, 02:02 PM
bals28mjk, it doesn't matter what the extension is, as long as the file contents is actually XML. You would use the load (http://nl.php.net/manual/en/domdocument.load.php) method like you would for any other file.
However, if it is a file on the local file system, you would not want to load it via a file system path, as the PHP would not then be executed, so you would be trying to parse the PHP source and the the XML/HTML/XHTML that it outputs. You would need to access it via a URL even if it's on the same host.

bals28mjk
07-03-2008, 03:22 PM
However, if it is a file on the local file system, you would not want to load it via a file system path, as the PHP would not then be executed, so you would be trying to parse the PHP source and the the XML/HTML/XHTML that it outputs. You would need to access it via a URL even if it's on the same host.Yeah, that's the issue I was trying to get around, calling the file with a url instead works. :)

Um... I don't think there is any such thing as the PHP DOM. PHP is simply a programming language used to generate webpages.
Check this out Mr Initial Man, it might interest you: http://gtk.php.net/

It's a language binding used to build stand alone apps with php. I'm working on a personal project right now that uses it.

@all Thanks for sharing/helping. ;)