Jump to content
Sign in to follow this  
tbond

Fix for "No Response" DHL Module issue

Recommended Posts

Hi Gang!

 

The Airborne or now called DHL Module is available. Download the DHL Airborne v1.41 in the Contributions->Shipping Modules area of the contributions page.

 

First you need an account number, system ID, password and shipping key from DHL. Go to their site http://www.dhl.com/ and apply for an account. You have to give them all your info and credit card number of course. They email you the account number in a few hours usually, always less than 24 hours.

 

Once you have that, you email XMLRequests@dhl.com and ask for the System ID, Password and Shipping Key. They generate that for you and email it to you. That happens fast too if you do it before 6pm Paciific Time Monday to Friday.

 

Once you have that, you can get DHL Module v1.41 to work. I did it with osCommerce 2.2 MS2.

Here is how...

 

WARNING: It may not work on your system due to a problem where your own server does not accept the SSL certificate from DHL for some reason. You'll know this happens if you turn on the debug in the module after successfully installing it with your System ID, Password, Account No., and Shipping Key you get from DHL after emailing them at XMLRequests@dhl.com. Once you see the debug code and there is NO RESPONSE showing on the top of the screen from the server, you have the problem!

 

Here is the fix. Have your server admin install the 'executable binary' of cURL so you can call it from the code, without having to go through the usual stuff about waiting for the SSL and so on.

 

Open the file at catalog/includes/modules/shipping/dhlairborne.php and scroll down to line 388 or so until you see this code...

 

------------- code below --------------

 

// begin cURL engine & execute the request

if (function_exists('curl_init')) {

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://eCommerce.airborne.com/$api");

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, "$request");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 

$airborne_response = curl_exec($ch);

curl_close($ch);

} else {

// cURL method using exec() // curl -d -k if you have SSL issues

exec("/usr/bin/curl -d \"$request\" https://eCommerce.airborne.com/$api", $response);

$airborne_response = '';

foreach ($response as $key => $value) {

$airborne_response .= "$value";

}

}

 

------------- end of the code we're looking at ------------

 

Now, You are going to replace the code above with this code between the dotted lines...

 

------------- copy and replace the code above with this -----------

 

// begin cURL engine & execute the request

////if (function_exists('curl_init')) {

//// $ch = curl_init();

 

// new tbond sep2-05 fix

//// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

 

//// curl_setopt($ch, CURLOPT_URL, "https://eCommerce.airborne.com/$api");

//// curl_setopt($ch, CURLOPT_HEADER, 0);

//// curl_setopt($ch, CURLOPT_POST, 1);

//// curl_setopt($ch, CURLOPT_POSTFIELDS, "$request");

//// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 

//// $airborne_response = curl_exec($ch);

//// curl_close($ch);

////} else {

// cURL method using exec() // curl -d -k if you have SSL issues

exec("/usr/bin/curl -k -d \"$request\" https://eCommerce.airborne.com/$api", $response);

$airborne_response = '';

foreach ($response as $key => $value) {

$airborne_response .= "$value";

}

////}

 

---------------- end of replaced code -----------------

 

NOTE: Don't copy or replace the dotted lines!!!

 

What this does is tell your server to ignore the SSL certificate problems

that it may encounter and to 'trust' the incoming response from DHL.

 

That should fix the problem!

 

BTW, if you have problems with your server admin doing this for you, I

recommend our hosting company http://www.hostmysite.com/. We worked

this out with Bill, one of their 24/7 dedicated hosting engineers.

They offer reasonable hosting prices, linus and windows servers, and live

answer-on-the-second-ring telephone support, 24/7. They're great!

 

Good luck to everyone!

 

-- Tom Bond,

Webmaster

http://www.americal.com/

Share this post


Link to post
Share on other sites

This works well for a temporary fix, which is why I put that "curl -d -k if you have SSL issues" comment in the code.

 

However, you really should look or encourage your system admin to look into updating the curl certificate bundles on the server. It is not that the DHL cert is invalid. It is very much valid. it is just that some servers do not "trust" it because those servers have old bundles they look at to determine if something should be trusted or not. Updating your curl cert bundles is not that difficult to do. ;)

 

You can also get SSL issues if Curl or OpenSSL was incorrectly installed or configured, in which case, again I'd suggest encouraging your system admin to fix the problem, while using something like this as a temporary solution.

Edited by dreamscape

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Share this post


Link to post
Share on other sites

Do you know how to do this if I am using Windows and not Linux for my Webserver, because I can't use "/usr/bin/curl" ?

 

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×