Пример #1
0
    $rate = new UpsAPI_RatesAndService($shipment, $shipper, $ship_from, $destination);
    $xml = $rate->buildRequest();
    // check the output type
    if ($_POST['output'] == 'array') {
        $response = $rate->sendRequest($xml, false);
        echo 'Response Output:<br />';
        var_dump($response);
    } else {
        $response = $rate->sendRequest($xml, true);
        echo 'Response Output:<br />';
        echo '<pre>' . htmlentities($response) . '</pre>';
    }
    // end else the output type is XML
    var_dump($rate->isError());
    var_dump($rate->getError());
    var_dump($rate->getWarnings());
    var_dump($rate->getPackageCharges());
    var_dump($rate->getShipmentCharges());
    var_dump($rate->getPackageWeight());
    var_dump($rate->getShipmentWeight());
} else {
    $packaging_codes = array('00' => 'UNKNOWN', '01' => 'UPS Letter', '02' => 'Package', '03' => 'Tube', '04' => 'Pak', '21' => 'Express Box', '24' => '25KG Box', '25' => '10KG Box', '30' => 'Pallet', '2a' => 'Small Express Box', '2b' => 'Medium Express Box', '2c' => 'Large Express Box');
    // end $packaging_codes
    $service_codes = array('01' => 'UPS Express', '02' => 'UPS Expedited', '03' => 'UPS Ground', '07' => 'UPS Express', '08' => 'UPS Expedited', '11' => 'UPS Standard', '12' => 'UPS Three-Day Select', '13' => 'UPS Saver', '14' => 'UPS Express Early A.M.', '54' => 'UPS Worldwide Express Plus', '59' => 'UPS Second Day Air A.M.', '65' => 'UPS Saver', '82' => 'UPS Today Standard', '83' => 'UPS Today Dedicated Courrier', '84' => 'UPS Today Intercity', '85' => 'UPS Today Express', '86' => 'UPS Today Express Saver', '308' => 'UPS Freight LTL', '309' => 'UPS Freight LTL Guaranteed', '310' => 'UPS Freight LTL Urgent', 'TDCB' => 'Trade Direct Cross Border', 'TDA' => 'Trade Direct Air', 'TDO' => 'Trade Direct Ocean');
    // end $service_codes
    $weight_um = array('LBS' => 'Pounds', 'KGS' => 'Kilograms');
    // end $weight_um
    ?>
	<form method="post" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>