Hey All,
Attemping to build my first API and hit my first and probably most important bump...
The remote website will be sending XML to me via curl, using the following:
$xml = '<rqst>
<customer user="joebloggs">
<email>email_input</email>
<firstname>firstname_input</firstname>
<lastname>lastname_input</lastname>
<address1>address1_input/address1>
<address2>address2_input</address2>
<towncity>towncity_input</towncity>
<countyregion>countyregion_input</countyregion>
<postcode>postcode_input</postcode>
<country>country_input</country>
<telephone>telephone_input</telephone>
<mobile>mobile_input</mobile>
</customer>
</rqst>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.domainname.com/createcustomer.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "domainname.com php version 0.1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$response = curl_exec ($ch);
curl_close ($ch);
But I'm not sure how to handle that at my end, how do I split up the posted XML so I end up with variables for each tag, customer, email, address1... etc. ?
Once I process the xml they send, I'll be reading out a sucess XML for them to use at their end.
Can anyone give me a kick in the right direction?
Thanks