Jump to content

DOMDocument - from PHP5 to PHP4


AdmiralAkbar

Recommended Posts

I just finished (or so I thought) a project. But my client's server runs PHP4, so I need to adapt my code. Here's what stopped working:

 

$localClasses = new DOMDocument;
$localClasses -> load("file.xml");
$localClasses -> get_elements_by_tagname('Title') -> item(0) -> firstChild -> nodeValue

 

Here's my petty attempt at trying to adapt this code to run in PHP4:

 


$file = file_get_contents("localClasses.xml");
$localClasses = new DOMDocument($file);

$test = $localClasses -> get_elements_by_tagname('Title');
$testText = $test -> item[0] -> firstChild -> nodeValue;
print $testText;

 

This doesn't give me any errors, but nothing shows up. Any help would be appreciated. Thanks for reading!

 

Link to comment
https://forums.phpfreaks.com/topic/234112-domdocument-from-php5-to-php4/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.