PHP - Convert incoming HTTP POST into variables



I'm working with a web service that is submitting an HTTP POST to a PHP page as follows:


FORM/POST PARAMETERS: None


HEADERS: Content-Type: text/xml


BODY:



<?xml version="1.0"?>
<mogreet>
<event>message-in</event>
<type>command_sms</type>
<campaign_id>12345</campaign_id>
<shortcode>123456</shortcode>
<msisdn>15552345678</msisdn>
<carrier><![CDATA[T-Mobile]]></carrier>
<carrier_id>2</carrier_id>
<message><![CDATA[xxxx testing]]></message>
</mogreet>


I need to be able to convert each of the XML elements into PHP variables so I can update a database. I've never had to work with an incoming POST with XML data before and not sure where to starT - I am familiar with processing incoming GET/POST requests but not raw xml.


No comments:

Post a Comment