Connecting Tech Pros Worldwide Help | Site Map

PHP/DOM Error

  #1  
Old June 17th, 2009, 04:41 PM
Familiar Sight
 
Join Date: Sep 2008
Posts: 252
I'm getting the below error and can't figure out what I'm doing wrong??

I'm using php 5.2.9.9. This is what is in the PHP info file:
Quote:
DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.7.3
HTML Support enabled
XPath Support enabled
XPointer Support enabled
Schema Support enabled
RelaxNG Support enabled
Heres my code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>test</title>
  4.  
  5. </head>
  6. <body>
  7. <?php
  8. $strRssFeed = "http://rss.cnn.com/rss/cnn_world.rss";
  9.  
  10. $xml = implode ('', file($strRssFeed));
  11.  
  12. $dom = domxml_open_mem($xml);
  13.  
  14. $root = $dom->document_element();
  15.  
  16. $title = $root->get_elements_by_tagname("title");
  17. $desc = $root->get_elements_by_tagname("description");
  18. $link = $root->get_elements_by_tagname("link");
  19.  
  20. for($i=0;$i<count($title);$i++)
  21. {
  22. echo "<p>";
  23. echo "<a href=\"".$link[$i]->get_content()."\">".$title[$i]->get_content()."</a>";
  24. echo "<br>".$desc[$i]->get_content();
  25. echo "</p>";
  26. }
  27. ?>
  28. </body>
  29. </html>
And heres the error in the apache logs:
Quote:
PHP Fatal error: Call to undefined function domxml_open_mem()
  #2  
Old June 17th, 2009, 05:05 PM
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,701
Provided Answers: 4

re: PHP/DOM Error


Hi.

This means that the DOM XML extension isn't installed on your server. (Or at least, not loaded by that particular script.)
DOMXML is not bundled with PHP5 anymore. If you want to use it, you need to install it. (See here for instructions on that).

You might want to consider using one of the other XML Manipulation methods. Like DOM or SimpleXML.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help gunimpi answers 0 January 10th, 2007 08:55 PM
Error in IE torbs answers 9 October 22nd, 2005 06:25 PM
appendData() DOM James answers 2 September 18th, 2005 03:05 AM
PHP, DOM, XML questions.. John VanRyn answers 2 July 17th, 2005 09:52 AM