ASP - UPS shipping Rate

Asked By Michael Clinton on 15-May-02 06:31 PM
Hey guys, thanks for a great site for us developers to find info to get our work done.
I am in a situation that I need to write code that talks to UPS to get shipping rates. I already signed up for the access account to UPS and got their example files, but they are writtin in Java and Visual Basic.
Do you guys have code that will work in ASP?
All I want is to send 2 zip codes, weight and get back shipping rates.
Thanks
mikec

If you open up their VIsual Basic code

Asked By Peter Bromberg on 15-May-02 06:52 PM
that should be easy to translate to VBScript that will run in an ASP page on a windows IIS webserver.
Otherwise, basically you'll need to view source on the form page that you fill in to get the shipping rates, and then write your own code probably using xmlhttp to post the correct values to the target of the form. The page that comes back you'll need to parse with either string manipulation or regex functions to screenscrape out the data you want. There are some good articles on screenscraping right on this site.

Info from UPS, the screen scraping at

Asked By Michael Clinton on 17-May-02 03:49 PM
I found a lot of sites that had reference to http://www.ups.com/using/services/rave/qcostcgi.cgi technique, but this posting http://www.ec.ups.com/ecommerce/techdocs/updates_070600.html from UPS says that it is discontined, but still works.
I know there are a few com objects out there that do what I want to do, but I wanted to do it in ASP.
Thanks for you advise, I will try to recode the Visual Basic example in Classic ASP.
Also, I have looked at another site that had written in ASP.Net Web Service, but they mention a program called WebServiceUtil.exe, that I assume was part of the beta package of ASP.Net.  So I am a bit confused there.

Look here

Asked By Peter Bromberg on 17-May-02 07:41 PM
If you go to UPS, this is the URL:
http://wwwapps.ups.com/servlet/QCCServlet?iso_language=en&iso;_country=US
When you VIEW SOURCE on this page, you'll see where the FORM is to be posted:
 <FORM METHOD="POST" ACTION="/servlet/QCCServlet">
(e.g. http://wwwapps.ups.com/servlet/QCCServlet)
Then you need to examine the rest of the source to see the form Name/value pairs
that are required for a successful POST. For example:
  <INPUT TYPE="HIDDEN" NAME="iso_language" VALUE="en">
            <INPUT TYPE="HIDDEN" NAME="iso_country" VALUE="US">
        <INPUT TYPE="HIDDEN" NAME="action"  VALUE="packageinfo">
 <SELECT NAME="origcountry">
 <INPUT TYPE="TEXT" NAME="origpostal" SIZE="6" MAXLENGTH="10" VALUE="">
.etc.
Then just use XMLHTTP from your ASP page to make the form post programmatically (we have an article here that shows how to do it)
You will have the results of the post in the Xmlhttp.responseText Property.
You can then assign this to a string variable, and parse it to your heart's content.
Hope this helps!
Re
Kamran Paracha replied to Michael Clinton on 31-Jul-09 03:13 PM
If you want to buy, see http://www.pexsol.com/UPS/default.aspx - it's quiet simple and available for $50 with complete source and no limitation.