| | 26 | == Usage == |
|---|
| | 27 | |
|---|
| | 28 | {{{ |
|---|
| | 29 | |
|---|
| | 30 | //Populate these with your UPS developer account/key info |
|---|
| | 31 | //You can register at https://www.ups.com/one-to-one/register?sysid=myups&lang=en&langc=US&loc=en_US |
|---|
| | 32 | $accessKey = ''; |
|---|
| | 33 | $userId = ''; |
|---|
| | 34 | $password = ''; |
|---|
| | 35 | $shipperPostalCode = ''; |
|---|
| | 36 | $shipperCountry = ''; |
|---|
| | 37 | $upsAccountNumber = ''; |
|---|
| | 38 | |
|---|
| | 39 | //Create the object thru which we will make UPS API requists |
|---|
| | 40 | $ups = new UPSShipping($accessKey, $userId, $password, $shipperPostalCode, $shipperCountry, $upsAccountNumber); |
|---|
| | 41 | $ups->debugOn = true; |
|---|
| | 42 | |
|---|
| | 43 | //Get a price quote for a single shipping type |
|---|
| | 44 | $price = $ups->getSingleShippingCost(97007, 'US', 90210, 'US', UPSShipping::SERVICE_CODE_GROUND, 1.2, 12, 12, 12); |
|---|
| | 45 | print "Price is $price\n"; |
|---|
| | 46 | |
|---|
| | 47 | //Get a list of price/shipping type options |
|---|
| | 48 | $priceList = $ups->getShippingPriceOptionList(97007, 'US', 90210, 'US', 1.2, 12, 12, 12); |
|---|
| | 49 | print "Options are : " . print_r($priceList, true) . "\n"; |
|---|
| | 50 | |
|---|
| | 51 | }}} |
|---|