pbvamsi Posted January 27, 2012 Share Posted January 27, 2012 My XML file looks like <entry> some tags <title type='text'> content to be extracted </title> <content type='text'> content to be extracted </content> </entry> (there will be 3-4 titles and descriptions in each entry tag, bt i want only whose type is text) i used $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadXML("kFeed.xml"); $entryTag = $dom->getElementsByTagName("entry")->item(0); $title = $entryTag->getElementsByTagName("title")->item(0)->nodeValue; $descr = $entryTag->getElementsByTagName("content")->item(0)->nodeValue; the error i get is Fatal error: Call to a member function getElementsByTagName() on a non-object can someone help me to fix this problem. thanks Quote Link to comment https://forums.phpfreaks.com/topic/255867-get-tag-value-from-xml-using-php/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.