Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fix for "No Response" DHL Module issue


tbond

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 [email protected] 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 [email protected]. 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/

Link to comment
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

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...