DHL XML API Webservice

In: PHP| Programming language

27 Jul 2014

I recently had to work on integrating an ERP with DHL XML API Services. I could not find a PHP open source library to consume their API, so I decided to share the one that I wrote.

You can download the code on github : https://github.com/alfallouji/DHL-API

If you want to read documentation about the DHL XML API Service, their toolkit can be downloaded from here: https://xmlpi-ea.dhl.com/

Description

The library is a PHP Oriented Object client for the DHL XML API Services. DHL XML Services is an online web services integration capability that provides DHL’s service availability, transit times, rates, shipment and courier pickup booking along with shipment tracking from over 140 countries around the world. Using DHL’s XML Services, customers can incorporate DHL shipping functionality into their websites, customer service applications or order processing systems.

Usage

The client does not rely or depend on any framework and it should be fairly easy to integrate with your own code. You can use the autloader that is provided or your own autoloading mechanism.

The sample folder contains examples on how to use the client and perform requests to DHL XML API, such as track a shipment, create a shipment, request a pickup or print labels.

In order to have the samples working, you will need to create a DHL staging account. You can do that by going to that URL : DHL - XML API Services

Then, you need to edit the config/config.php file and provide your account id and password. The samples use those credentials.

return array(
‘id’ => ‘Your_DHL_ID’,
‘pass’ => ‘Your_DHL_Password’,
);

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

1 Response to DHL XML API Webservice

Avatar

dipan

June 30th, 2016 at 2:49 pm

Hi Bashar
It’s really awesome that you wrote this code. IT’ll save tones of time of all developer.

Please let me know will this work for Canada(shipper) and US(receiver)? It’d be great help if you comment on this.

Thanks!

Comment Form

Who am I?

My name is Bashar Al-Fallouji, I work as a Service Architect at Origin Energy (Sydney, Australia).

I am particularly interested in Web applications, Open Source Development, Software Engineering, Information Architecture, Unit Testing, XP/Agile development, etc.

On this blog, you will find mostly technical articles and thoughts around PHP, OOP, OOD, Unit Testing, etc. I am also sharing a few open source tools and scripts.

  • dipan: Hi Bashar It's really awesome that you wrote this code. IT'll save tones of time of all developer. [...]
  • Bashar: Glad that you liked it ! [...]
  • Angel S. Moreno: well, there goes wasting a couple of hours of development and a couple of days of testing. I owe you [...]
  • Bashar: Thats right, the setSaveFile create a files containing an associative array of classname => filen [...]
  • Loggy: Jim's clarification in particular was pretty useful although I did have to dig down into the tree to [...]