I'm trying to retrieve data from an api using curl with this code:
$xml_data = '<name>foobar%</name>';
$URL = "http://www.example.com/api/foobar.xml";
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
$output = curl_exec($ch);
curl_close($ch);
When I execute this php script, all works well and the correct xml data is returned in my browser. My question is, how can I parse this data?
(If you recommend I do the whole thing using a different method as curl, feel free to tell me)