This example shows you how to parse the XML postback that you received from CallFire
<?
$contents = $HTTP_RAW_POST_DATA;
/*
You Have the XML response in $contents
The Sample Call Finish Postback looks something like this
<?xml version=\"1.0" encoding="UTF-8"?>
<call-finished>
<callid>111111</callid>
<campaignid>22222</campaignid>
<phonenumber>2132212289</phonenumber>
<dnis>8778973473</dnis>
<tags>
<tag>sales number</tag>
<tag>houston</tag>
</tags>
<disposition>TRANSFER</disposition>
<duration>35</duration>
<callstart>2010-03-24 15:58:18.0</callstart>
<notes>
notes that a call center campaign will add to a call.
</notes>
<extra-data>
additional data uploaded with the phone number
</extra-data>
<agentid>21212</agentid>
<agentresponse>interested</agentresponse>
<responsetime>2010-03-24 15:58:38.0</responsetime>
<stored-data>
<var name="bigconcern">economy</var>
<var name="willvote">yes</var>
</stored-data>
<recordings>
<file>
https://www.callfire.com/cloud/1/files/recording/
</file>
</recordings>
</call-finished>
*/
/*
Once you have the above XML, you need simple parse the XML to get the contents from the XML
One way of doing this would be to use a simple DOM parser
An example of how to do that is show below
*/
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($contents);
$x = $xmlDoc->documentElement;
foreach ($x->childNodes AS $item) {
print $item->nodeName.":",$item->nodeValue;
}
/*
In the example shown above, I am just prinitng the values.
Depending on your use case, you might want to store it in your database
*/
?>
