$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Ground Domestic Shipping Request using PHP ***'); $request['Version'] = array( 'ServiceId' => 'ship', 'Major' => '17', 'Intermediate' => '0', 'Minor' => '0' ); $request['RequestedShipment'] = array( 'ShipTimestamp' => date('c'), 'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION 'ServiceType' => 'SMART_POST', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ... 'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... 'Shipper' => addShipper(), 'Recipient' => addRecipient(), 'ShippingChargesPayment' => addShippingChargesPayment(), 'SmartPostDetail' => addSmartPostDetail(), 'LabelSpecification' => addLabelSpecification(), 'PackageCount' => 1, 'RequestedPackageLineItems' => array( '0' => addPackageLineItem1() ) ); try { if(setEndpoint('changeEndpoint')){ $newLocation = $client->__setLocation(setEndpoint('endpoint')); } $response = $client->processShipment($request); // FedEx web service invocation
$request['WebAuthenticationDetail'] = array('ParentCredential' => array('Key' => getProperty('parentkey'), 'Password' => getProperty('parentpassword')), 'UserCredential' => array('Key' => getProperty('key'), 'Password' => getProperty('password'))); $request['ClientDetail'] = array('AccountNumber' => getProperty('shipaccount'), 'MeterNumber' => getProperty('meter')); $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** SmartPost Rate Request using PHP ***'); $request['Version'] = array('ServiceId' => 'crs', 'Major' => '18', 'Intermediate' => '0', 'Minor' => '0'); $request['ReturnTransitAndCommit'] = true; $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ... $request['RequestedShipment']['ShipTimestamp'] = date('c'); $request['RequestedShipment']['ServiceType'] = 'SMART_POST'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ... $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... $request['RequestedShipment']['Shipper'] = addShipper(); $request['RequestedShipment']['Recipient'] = addRecipient(); $request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment(); $request['RequestedShipment']['SmartPostDetail'] = addSmartPostDetail(); $request['RequestedShipment']['PackageCount'] = '1'; $request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1(); try { if (setEndpoint('changeEndpoint')) { $newLocation = $client->__setLocation(setEndpoint('endpoint')); } $response = $client->getRates($request); echo 'here'; if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') { $rateReply = $response->RateReplyDetails; echo '<table border="1">'; echo '<tr><td>Service Type</td><td>Amount</td><td>Transit Time</td><td>Max Transit Time</tr><tr>'; $serviceType = '<td>' . $rateReply->ServiceType . '</td>'; if ($rateReply->RatedShipmentDetails && is_array($rateReply->RatedShipmentDetails)) { $amount = '<td>$' . number_format($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount, 2, ".", ",") . '</td>';