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’,
);

Be Sociable, Share!

6 Responses 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!

Avatar

Rahul Thakur

February 10th, 2017 at 3:47 am

as i was not able to copy hence removing the angular brackets

Avatar

alex davila

August 3rd, 2017 at 2:22 pm

Hi bashar
Is there a way to use web service from

http://xmlpitest-ea.dhl.com/XMLShippingServlet

then if everything is ok change to production to

http://xmlpi-ea.dhl.com/XMLShippingServlet

Regards

Alex Davila

Avatar

alex davila

August 3rd, 2017 at 2:44 pm

Hi Bashar
is there any pick up example??

Regards

Alex Davila

Avatar

Mohamed

August 4th, 2017 at 5:26 am

Hello bashar,

I hope you are doing well.
Thank you for your hard work, and thank you for sharing with us !
I didn’t found a sample for “request a pickup” on DHL-API, do you have one please ?

Thanks!

Avatar

vivek raj

December 20th, 2018 at 7:14 am

Hello Bashar,
It’s really good that you wrote this code. but I’m confused some part. can you support me?

Comment Form

Who am I?

My name is Bashar Al-Fallouji, I work as a Enterprise Solutions Architect at Amazon Web Services.

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

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.

  • Trinzia: Well done, my friend! [...]
  • vivek raj: Hello Bashar, It's really good that you wrote this code. but I'm confused some part. can you suppor [...]
  • irfan: I saw watch your youtube talk on clean and testable code. By the way very good talk. I was wondering [...]
  • Mohamed: Hello bashar, I hope you are doing well. Thank you for your hard work, and thank you for sharing [...]
  • alex davila: Hi Bashar is there any pick up example?? Regards Alex Davila [...]