How to parse an XML file using PHP?

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-03-27T14:22:31Z Indexed on 2010/03/27 14:33 UTC
Read the original article Hit count: 348

Filed under:
|

Here I have a variable 'response' which is obtained by parsing an XML file.

$url = 'http://xxxxx.xml';
$ch = curl_init($url);
$response = curl_exec($ch); 

The url structure is as follows -

<user>
<id>734</id>
<name>Peter Parker</name>
-
<status>
 <favorited>false</favorited>
</status>
</user>

How to access each bit of info like id,name,favorited from response?

© Stack Overflow or respective owner

Related posts about php

Related posts about beginner