Troubleshooting¶
Showing Debug Information¶
If something isn’t going quite as planned and you want to see what is going on in the background, you can always print out the xml that was sent and the corresponding response by calling the debug() function.
Here is an example of showing the debug information after a rate request:
<?php
$rate = new \RocketShipIt\Rate('UPS');
$rate->setParameter('toCode','90210');
$rate->setParameter('weight','5');
$rate->setParameter('insuredCurrency','USD');
$rate->setParameter('monetaryValue','700');
$response = $rate->getRate();
echo $rate->debug(); // This is the line that will echo out the debug info
Here is an example of showing the debug information after a void request:
<?php
$void = new \RocketShipIt\Void('UPS');
$response = $void->voidShipment('1Z12345E0390856432');
echo $void->debug(); // This is the line that will echo out the debug info
Note
When sending support requests to support@rocketship.it please provide debug information when possible.
UPS Special Characters¶
The UPS Shipping API supports UTF-8 and ISO8859-1 character sets, however the label generation backend system is limited to single byte Latin-1 characters. Consequently, multi-byte characters are not properly handled by the backend system. When we encoded the umlaut character “ö” with an HTML character entity reference (ö) the character was properly displayed on the label (see below). UPS recommends that all special characters are encoded using this method. They have placed the following encoding characters and Ship From and Ship To addresses were displayed on the label as follows:
<AddressLine1>Kleinheidstra Ö</AddressLine1> -----> KLEINHEIDSTRA ö
<AddressLine1>Kleinheidstra ß</AddressLine1> ------> KLEINHEIDSTRA ß
Here is a snippit of code from another RocketShipIt customer who got it to work:
$text = "This is a test with äÄ, öÖ, üÜ, ß characters.";
echo mb_encode_numericentity($text, array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
$shipment->setParameter('toCity', mb_encode_numericentity( $row[1]['Ort'], array(0x80, 0xffff, 0, 0xffff), 'ISO-8859-1' ));
$toAttentionName = mb_encode_numericentity(utf8_decode($toAttentionName), array(0x80, 0xffff, 0, 0xffff), 'ISO-8859-1');
UPS Errors¶
Q: I am getting: Error confirming shipment: The Shippers shipper number cannot be used for the shipment
A: Your UPS account number was flagged as inactive. You will need to contact UPS and have them activate it again.
Q: PHP Fatal error: Class ‘SoapClient’ not found.
A: You need to make sure you have the PHP SOAP Extension installed.
FedEx Errors¶
Q: I am getting: Failure - rating service unavailable.
A: This sometimes happens when the development server is temporarily out of service.
Q: FedEx is telling my I should be using the following url: https://gatewaybeta.fedex.com:443/web-services
A: This is incorrect this URL is for their SOAP implementation, RocketShipIt uses XML.
Getting an empty array?¶
RocketShipIt requires that the cURL extension is enabled in your version of PHP. If cURL is not enabled RocketShipIt will not be able to send a request to the UPS servers and you might end up with an empty array.
Another common reason for an empty array is a missing SSL certificate. This often happens when developers are working on a Windows based machine, most notably using the WAMP server. You can read more about the details on server SSL certificates on the curl website.
The easiest way to fix this is to add the following option in the request function of the ups class after ‘curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);‘:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
Still Getting an Empty Array?¶
Chances are that one of your parameters are not set right. Output the xmlSent and xmlResponse variables as described above and send them to support@rocketship.it and we will help you out.
Parse error around line 527¶
Are you getting something like:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in RocketShipItRandT.php on line 527
This is caused by using a PHP version prior to PHP 5. RocketShipIt requires that you use PHP 5+
Inaccurate Rates?¶
Why am I getting different rates from UPS.com/FedEx.com? This is a common question and can usually be resolved quickly with a little bit of troubleshooting:
- Make sure you are using production mode (debugMode = 0 in config.php). Development servers do not produce accurate rates.
- When comparing rates you need to make sure you are providing the exact same shipment parameters. For example, one parameter that can change the price dramatically is residential vs. commercial.
- Check your dropoffType parameter
- Are you requesting negotiated rates or retail rates?
- Are you logged into ups.com/fedex.com? When you log into UPS.com you are most likely going to get a negotiated rate (See Negotiated Rates) instead of a retail rate.
- When comparing rates it helps to do a getRate() or getAllRates() for a full breakdown including fuel surcharges and additional fees.
Prestashop¶
Having trouble loading RocketShipIt? This is because Prestashop uses an older method of autoloading classes in the file config/autload.php. You need to convert their __autoload function to a spl_autoload_register function:
<?php
// http://php.net/manual/en/function.spl-autoload-register.php
// function __autoload($class) {
// include 'classes/' . $class . '.class.php';
// }
function my_autoloader($class) {
include 'classes/' . $class . '.class.php';
}
spl_autoload_register('my_autoloader');
// Or, using an anonymous function as of PHP 5.3.0
spl_autoload_register(function ($class) {
include 'classes/' . $class . '.class.php';
});
Still need help?¶
No problem, just send an email to support@rocketship.it and we we’ll get you going. Please provide us the xmlSent and xmlRecieved when available.