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!
Hi all
Pretty new to PHP but trying to learn. I have written some code that parses html and gathers the img url and inserts into an xml for later use. All this works. I wish to parse the url and obtain the filename and insert it into a url also. I can get the filename out and echo it but can't seem to figure out how to get it to the xml using the code below.
For sake of time and space, not posting all the code just what is necessary.
You haven't mentioned which line it's complaining about specifically, nor can we see where $xml is instantiated, but my guess is that $xml either wasn't instantiated (properly).
Pretty sure xml is correct in that I use this same code in other projects and xml file is created. When $filename is parse from url I can echo it just fine but when trying to pass it into the line below the error occurs.
It's the line with //ERROR HERE
$FnameText= $xml->createTextNode($filename->nodeValue); //ERROR HERE
xml instantiated
$xml = new DOMDocument("1.0");
$root = $xml->createElement("music");
$book = $xml->createElement("song");