I am a noob at curl and xml, but I have searched this site and the web for an answer to this, and nothing I have found works.
I am sending XML using cURL and the recipient service is getting the data correctly and creating a response which I am receiving. The response is echo'd from curl_exec
as
<TRANS>
<HPAY>
<ID>223</ID>
<MLABEL>XXXX XXXX XXXX 9854</MLABEL>
<DATE>11/06/2013 21:00:36</DATE>
<SEN></SEN>
<REC>sc</REC>
<DEB>0.00</DEB>
<CRED>10.34</CRED>
<COM>2.00</COM>
<MSG></MSG>
<STATUS>3</STATUS>
</HPAY>
</TRANS>
Now I need to turn these in to variables, and now I am scratching my head at how to do this.
Edit, tried pasting browser source here but it keeps changing it. However, to answer a previous comment, it is an xml response
Just Use SimpleXMLElement
$xml = new SimpleXMLElement($data);
$details = array();
foreach($xml->HPAY->children() as $k => $v) {
$details[$k] = "$v";
}
print_r($details);
Output
Array
(
[ID] => 223
[MLABEL] => XXXX XXXX XXXX 9854
[DATE] => 11/06/2013 21:00:36
[SEN] =>
[REC] => sc
[DEB] => 0.00
[CRED] => 10.34
[COM] => 2.00
[MSG] =>
[STATUS] => 3
)
You need to extract the data with XML parser like xpath