This tag will return a multi-dimensional array containing shipping methods and rates for shipping a package using your choice of several shipping carriers. All necessary information for getting accurate rate quotes can be specified in request. You must have an account with InterShipper, and agree to their terms of service to use this class. Accounts are available at no cost, and no charge is made for the service. Please see InterShipper's site for further information. Use of this tag implies agreement with InterShipper's licensing requirements.
5 APR 2000: Version 1.5 InterShipper now supports the Track() method for retrieving tracking information on shipments. The version number was brought into line with the ColdFusion version. Changed separator for carriers to comma for safety and consistency. Pipe symbol will continue to work, but is deprecated.
29 FEB 2000: Version 0.9 Initial development and testing. All parameters are active, and the class is fully functional. It just requires better data-validation and error-control.
<? include('intershipper.php'); // Create a class instance $IShip = new InterShipper(); // Set parameters $IShip->setVar("email", "youraccountemail"); $IShip->setVar("password", "yourpassword"); $IShip->setVar("Opostalcode", "85224"); $IShip->setVar("Dpostalcode", "19605"); $IShip->setVar("carriers", "ANX|FDX|UPS|USPS"); $IShip->setVar("weight", 1.1); // Send the request if($IShip->Quote(30)) { // If it succeeds... // $quote will hold the array $quote = $IShip->getQuote(); } else { // Print the error message echo $IShip->getError(); } ?>
Please note that these requests are made in clear text. Technically, the only sensitive information is the email and password fields, and quite frankly, the risk is very low since there's not much that can be done with them other than request shipping info. However, if this is a consideration, InterShipper supports having these two fields encrypted using DES56, and Base64 encoded. Just encrypt the field using your IP address as the key, Base64 encode the result, and use that for the parameter. InterShipper also supports the use of arbitrary keys by setting the key on their website. For more information, please see the API documentation at InterShipper's website.
boolean setVar($variable, $value) | Used to set a parameter's value. Returns false if the parameter is invalid or if the data is not appropriate for the parameter. Returns true otherwise. |
boolean getData($timeout, $request_type) | Used to perform a request. The timeout value is the number of seconds to wait for the answer. The request_type is either "QUOTE" or "TRACK". Returns true if the request succeeds. Returns false if any error occured. |
boolean Quote($timeout) | Alias for getData($timeout, "QUOTE"). Deprecated. |
boolean Track($timeout) | Alias for getData($timeout, "TRACK"). Deprecated. |
array getQuote() | Returns an array of shipping methods. Note that this array may be empty even on a successful request if there were no methods that fit the request. |
array getTrack() | Returns an array of tracking information. |
string getError() | Returns the text description of the last error that occurred. |
ALL Requests | ||
Required | Specifies the email address provided to InterShipper when the InterShipper account was created. | |
password | Required | The password for the InterShipper account. |
carriers | Optional | Specifies the carriers to be queried for rates. Multiple carriers should be comma-separated, ie: FDX,UPS,USPS.
|
Quote() Requests | ||
Oaddress | Optional | Specifies the origin address. |
Ocity | Varies | Specifies the origin city. (Mandatory for countries that do not use postal codes.) |
Ostate | Optional | Specifies the origin state or province. |
Ocountry | Optional | Specifies the origin country. Defaults to US. This attribute can take most any recognizable country designator. |
Opostalcode | Varies | Specifies the origin postal code (Zip code.) This is mandatory for countries that use postal codes. |
Oresidential | Optional | Specifies that the pickup location is residential. Acceptable values are YES or NO. Defaults to NO. |
Daddress | Optional | Specifies the destination address. |
Dcity | Varies | Specifies the destination city. (Mandatory for countries that do not use postal codes.) |
Dstate | Optional | Specifies the destination state or province. |
Dcountry | Optional | Specifies the destination country. Defaults to US. This attribute can take most any recognizable country designator. |
Dpostalcode | Varies | Specifies the destination postal code (Zip code.) This is mandatory for countries that use postal codes. |
Dresidential | Optional | Specifies that the delivery location is residential. Acceptable values are YES or NO. Defaults to YES. |
weight | Required | Specifies the weight of the package. |
weightunits | Optional | Specifies the units the weight is specified in.
|
dimensionunits | Optional | Specifies the units used for measuring the dimensions of the package. Required when LENGTH, WIDTH and HEIGHT are provided.
|
length | Optional | Specifies the length of the package. |
width | Optional | Specifies the width of the package. |
height | Optional | Specifies the height of the package. |
shipdate | Optional | Specifies the date the package will be sent. Defaults to the current date. |
shipmethod | Optional | Specifies the pickup method.
|
packaging | Optional | Specifies the type of packaging.
|
packagematerial | Optional | Specifies the type of packaging material.
|
packagestyle | Optional | Specifies the style of packaging.
|
content | Optional | Describes the contents of the shipment.
|
contentdanger | Optional | Used when shipping dangerous materials.
|
liquidvolume | Optional | If the shipment contains liquid, this tag is required and should contain the volume of liquid. Can be any numeric value, including decimals. |
liquidunits | Varies | Required when LIQUIDVOLUME is used.
|
CODvalue | Optional | Amount in US Dollars to collect at time of delivery. |
declaredvalue | Optional | Amount in US Dollars to insure your shipment for. |
dutiable | Optional | Specifies whether your shipment is dutiable when shipped internationally. Should be YES or NO. Defaults to NO. |
Track() Requests | ||
trackingnum | Required | Specifies the tracking numbers to be queried. Multiple tracking numbers should be comma-separated. If more than one is being requested, be sure that the tracking numbers are in the same order as the carriers parameter. |
The getQuote() method will return a multi-dimensional array. The first dimension represents each shipping method, and the second dimension contains the details of that method.
quoteid | The quoteID attribute gives you a reference to retrieve this quote at a later time. (From InterShipper) |
carrierid | The carrierid attribute is always the same for each carrier. A numeric identifier for a specific carrier. |
carriername | The carriername attribute is the text that you can use to describe the carrier to your end user. |
methodid | The methodid attribute is always the same for each method. A numeric identifier for a specific method. |
methodcode | The methodcode attribute is a string identifier for the method and is similar to the methodid. |
methodname | The methodname attribute is the text that you can use to describe the shipping method to your end user. |
itemid | This tag is a unique identifier for each of this particular quote's methods. |
rate | The rate for this shipping method. |
transitdays | The number of business days that the shipment will be in transit. This does not include weekends or holidays. |
date | The expected date of delivery. Weekends and holidays are taken into account. |
time | The expected time of delivery. If the shipping method has no time commitment, this value will be 23:59 (end of day). |
guaranteed | If this value is YES, then the date and time reported are guaranteed by the carrier. If NO, then they are estimates. |
latestpickup | This is the latest time that a pickup will be made by the courier. The value returned will either be a time in hh:mm 24 hour format (e.g. '18:09' which is 6:09pm) or blank. If nothing is returned, data is not available for this courier. |
The getTrack() method will return a multi-dimensional array. The first dimension represents each tracking request, and the second dimension contains the details of that method.
carriercode | The Carrier code that was used to make the request. |
trackingnumber | The Tracking Number code that was used to make the request. |
servicetype | The Service Type name returned from the carrier. If the connection to the carrier failed, this field will contain "NO DATA RETURNED FROM CARRIER". If the tracking number is invalid or no data is available, this field will contain "INVALID OR NOT FOUND". |
statuscode | A numeric code representing the status of the request.
|
statuslevel | A numeric code representing the status of the shipment.
|
statustext | The text description of the status code. |
scandate | The date and time the last tracking entry was made for this shipment. |
deliverydate | The date of (anticipated) delivery for this shipment. |
deliveredto | The place the package was delivered to. |
signatory | The person who received the shipment. |
location | The address or company where the shipment was made. |
city | The city where the shipment was made. |
state | The state where the shipment was made. |
country | The country where the shipment was made. |
This document and the InterShipper class code are © 1999, 2000, Desert Raven, and are released under the conditions of the GNU LGPL. InterShipper is a registered trademark of BITS, Inc. Desert Raven is not affiliated with InterShipper or BITS Inc in any way, and neither InterShipper nor BITS Inc. are responsible for the operation of this class. Questions regarding this class should be addressed to Michael Sheldon at info@desertraven.com. Questions regarding the InterShipper service should be addressed to InterShipper.
Desert Raven