Page 1 of 1

configure UPS Bare Bones with PHP ?

Posted: Wed Jun 20, 2007 10:14 am
by revocause
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Anybody ever configure UPS XML script with PHP?
 
 Here's what i got for HTML page 

 [syntax="html"]

 <select name="shippingtype" STYLE="width: 120 px">
                <option selected="selected" value="">Please Select</option>
                                <option value="3">UPS Ground </option>
                                <option value="12">UPS 3 Day Select </option>
                                <option value="1">UPS Next Day Air</option>
                                <option value="2">UPS 2nd Day Air</option>
                                
                              </select>


the weight will be avaible as variable = $weight
in my page.

Do you know how to configure that XML script to send those UPS variables of 3,12, 1, 2 . and the $weight
and have it spit out something converted to say $shipping_charges ?


This is what i have so far , from their XML :

Code: Select all

<?php

$host = '(edited out)';
$user = '(edited out)';
$pass = '(edited out)';
$key  = '(edited out)';
$tozip = $_GET['zip'];
$weight = $_GET['weight'];

$query = 
<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>{$key}</AccessLicenseNumber>
<UserId>{$user}</UserId>
<Password>{$pass}</Password>
</AccessRequest>
<?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Bare Bones Rate Request</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<RequestAction>Rate</RequestAction>
<RequestOption>Shop</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
</PickupType>
   <Shipment>
   <Shipper>
   <Address>
   <PostalCode></PostalCode>
   <CountryCode>US</CountryCode>
   </Address>
   </Shipper>
   <ShipTo>
   <Address>
   <PostalCode>{$tozip}</PostalCode>
   <CountryCode>US</CountryCode>
   </Address>
   </ShipTo>
   <ShipFrom>
   <Address>
   <PostalCode></PostalCode>
   <CountryCode>US</CountryCode>
   </Address>
   </ShipFrom>
   <Service>
   <Code>01</Code>
   </Service>
   <Package>
   <PackagingType>
   <Code>02</Code>
   </PackagingType>
   <Dimensions>
   <UnitOfMeasurement>
   <Code>IN</Code>
   </UnitOfMeasurement>
   <Length>20</Length>
   <Width>20</Width>
   <Height>20</Height>
   </Dimensions>
   <PackageWeight>
   <UnitOfMeasurement>
   <Code>LBS</Code>
   </UnitOfMeasurement>
   <Weight>{$weight}</Weight>
   </PackageWeight>
   </Package>
   </Shipment>
</RatingServiceSelectionRequest>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]