Using PHP to integrate into systems using SOAP, API and XML feeds

Most projects I undertake involve integrating php based websites with other systems. The reasons for doing so are varied but most work has the intention of automating a process that would have to be done either offline or with a delay. The whole point of the Internet as an end-user is to allow users to perform tasks simply and as quickly as possible.

Here are some recent examples of seamless integration which I have done over the last few months

Is a bank account valid and can it take Direct Debits?

Postcode Anywhere provide an API which allows a system to send bank account details to them, and they return a number of details about an account. Details are returned in realtime and formatted in such a way as each piece of information such as bank address, account type and whether the account can accept Direct Debits is sent back in an XML array for use in a system.

For the client this saves time and money in assessing the customer’s banking profile which has a two-fold advantage – there is no need for the client to manually do an account check, and the customer knows immediately whether the order can proceed or not.

Selling digital music online

7Digital are a major online digital music vendor who also supply an API to allow third-party sites to purchase music from them. They provide a number of API calls which allow for the purchase of music, retrieval from their digital ‘locker’ and interrogation of the 7Digital catalogue.

The 7Digital API works using HTTP calls using the OAuth API authentication system to allow authorised users to access their 8 million track catalogue. The code for this project ran to over 3,000 lines to enable all the features of the API to be fully exploited. Best of all, the end users are kept on the host site and are unaware of the 7Digital system working behind the scenes.

Taking payments without customers leaving my site

SagePay provide a ‘Server’ version of their online payment system which allows a site with the necassary security in place to converse with their system via HTTPS calls to pass credit card details to be sent to the system and results returned for processing.

‘Server’ provides a very valuable service for clients. Many payment providers are available to take credit and debit card payments for e-commerce websites, but most involve the customer either leaving the site to the provider’s payment page, or some form of awkward ‘framing’ of their pages – a site within a site. SagePay’s Server product means that customers stay on the site and the payment process is completely managed in the style of the client’s choosing.

Adding an order straight into a client’s back-office system

The Khaos Control system is run by many companies to control their stock, order and back office system. It has a web API interface, which allows orders from other systems (in this case the web) to be placed directly into their system for handling as other orders would be. The API also provides stock information, handle catalogue/brochure requests and marketing information.

This SOAP-based API saves time and money once again as there is no manual entry of web orders required and it also provides the ability to give customers updates on their orders in realtime. There is also a reduced chance of human error creeping into the system, as the order the customer has in their basket is transplanted directly into their system.

So integration isn’t that hard?

I didn’t say that, but what it does prove is how useful and cost-effective it can be. With the right code, security and system access, integration between a website and other systems can be achieved.

The list I gave is by no means definitive – I have also integrated sites with Right Move’s API (Vebra Integration), Google Maps, RSS feeds for automated Twitter/News publishing and a warehouse fulfillment service to dispatch orders in realtime.

By Colin Harris

Leave a Reply

Your email address will not be published. Required fields are marked *

*

HTML tags are not allowed.