I have an observer event that is capturing customer details anytime they are updated. At this point it posts that information to a var log.
I would like to get it to post to a SOAP API url.
at this point I am trying to be pointed in the right direction of how to do this, I believe I need to write the information into an XML that matches the API.
I only have 6 fields that need to be filled so I don’t think it will be to hard.
$fon = $billingaddress->getTelephone();
$street1 = $billingaddress->getStreet(1);
$street2 = $billingaddress->getStreet(2);
$city = $billingaddress->getCity();
$region = $billingaddress->getRegion();
$postcode = $billingaddress->getPostcode();
The phone number doubles as the customer #
Can somebody help me with the code to write the XML?
2
Answers
This chunk will go inside your body tag, as shown in the examples HERE. For the XML, it is pretty straightforward, and you can do it as one
$request
variable instead of assigning several:NOTE:
I commented out the
Username
andPassword
because they weren’t included in your example, and I am unsure whether they are your API user’s credentials or related to the Customer.You shouldn’t need to write any XML when working with a SOAP API that already exists. Use the built-in
SoapClient
.Have a look at the answers to this question if you need help with that: How to make a PHP SOAP call using the SoapClient class