PHP doesn’t have an inbuilt SOAP wrapper, so in the example we are using PHP_SOAP.dll which will come with most LAMP installations.
To enable this SOAP wrapper you have to edit you php.ini file to include
You will also need to make sure that the php_Soap.dll file is in your ext directory
We will start with a simple retrieval of a campaign the code to do this is
This code is firstly defining the username, password and campaignId, the three arguments needed by the GetCampaign method. Then it builds the arguments into an array and passes this array into the method which returns the result as an object called result. The result object is then broken down into it constituent parts
The below code is to return a contact by email address
The result variable which is returned is a contact object which you need to handle like an array of objects, to get the data out of this you need to
Then you can iterate through the two arrays to get all the data out.
To insert data into BrotherMailer through the API is again similar; the code below is how you would insert a contact into BrotherMailer
What you may notice about the code above is the use of the variable builder i.e
What this does is sets the type of the dataField, this needs to be done else the API will reject the value as it won’t know what type it is.
These are the basic methods of using the API within PHP, if you have any difficulties using this then please contact firstname.lastname@example.org