2

What I received XML response is :

<?xml version="1.0" encoding="utf-8"?>
<response status="200">
   <invoice_id>829584</invoice_id>
</response>

I want "invoice_id" from above data. So anyone please help for the same. Thanks.

chris85
  • 23,846
  • 7
  • 34
  • 51
Bharat
  • 220
  • 1
  • 2
  • 9
  • 2
    Possible duplicate of [How do you parse and process HTML/XML in PHP?](http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php) – chris85 Dec 21 '15 at 06:03

1 Answers1

2

try it with:

$xml = '<?xml version="1.0" encoding="utf-8"?>
           <response status="200">
               <invoice_id>829584</invoice_id>
           </response>';
$xmldom = simplexml_load_string($xml);

echo $xmldom->invoice_id->__toString();

for more detail have a look at Php simple load xml

Chetan Ameta
  • 7,696
  • 3
  • 29
  • 44