I have searched here and the rest of the net and I can't find any help with this.
I have a response from a curl_exec. The response is an XML string called $output.
echo '<pre>' . htmlentities($output) . '</pre>';
Gives:
<?xml version="1.0" encoding="utf-8"?>
<RESPONSE>
<FIELDS>
<FIELD KEY="status">1</FIELD>
<FIELD KEY="auth_code">DEMO43</FIELD>
<FIELD KEY="auth_response">APPROVED</FIELD>
<FIELD KEY="avs_code">X</FIELD>
<FIELD KEY="cvv2_code"> </FIELD>
<FIELD KEY="order_id">12345678900015</FIELD>
<FIELD KEY="reference_number">47210</FIELD>
<FIELD KEY="error" />
<FIELD KEY="available_balance" />
<FIELD KEY="is_partial">0</FIELD>
<FIELD KEY="partial_amount">0</FIELD>
<FIELD KEY="partial_id" />
<FIELD KEY="original_full_amount" />
<FIELD KEY="outstanding_balance">0</FIELD>
</FIELDS>
</RESPONSE>
I need to pull out specific information, for example, the value associated with "auth_code" (ie: DEMO43).
After many hours of fruitless searching, I need help. How do I get this data into an associative array like:
$array = ('status'=>'1','auth_code'=>'DEMO43' ... etc) ?
simplexml_load_string().