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.
bals28mjk, it doesn't matter what the extension is, as long as the file contents is actually XML. You would use the load method like you would for any other file.
bals28mjk, it doesn't matter what the extension is, as long as the file contents is actually XML. You would use the load 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.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
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.
Originally Posted by Mr Initial Man
Um... I don't think there is any such thing as the PHP DOM. PHP is simply a programming language used to generate webpages.
Bookmarks