How to read xml file in PHP

Total Post:154

Points:1086

PHP 
PHP
 2361  View(s)
Ratings:
Rate this:

Hi Guys,

Can someone tell me, how to read xml file in php?

Thanks

  1. Re: How to read xml file in PHP

    Hi Manoj Bhatt,
    To read XML file in PHP, you can use the following code:

     // Create DOMDocument object
               $xmlDoc = new DOMDocument();
    // load XML file
                $xmlDoc->load("YourFile.xml");
                $ptag = $xmlDoc->getElementsByTagName('ParentNode');
                $childQType=$ptag->item($i)->getElementsByTagName('ChildNode');
                echo $childQType->item(0)->childNodes->item(0)->nodeValue;  
    So in the same manner you can get all nodes values.              

      Modified On Mar-29-2018 04:55:25 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.