Jump to content

Building a Custom Web viewer for zip+4 look-up


Gilwell

This topic is 6436 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I was completely taken by the Google maps web viewer and how simple it was to add a viewer to a layout, match the Google address fields to my database address fields and have a map for every person's address in my membership database (being able to switch the view to satellite was a bonus - it showed that address USPS said was undeliverable was now a vacant lot :-). It did get me thinking about another useful addressing tool, - looking up zip+4 zip codes from the USPS website. The task is virtually the same - USPS wants three fields of information street, city and state, just like google maps. Unfortunately FM doesn't automatically give you the USPS field names to match like it does for Google. Even worse, looking at the USPS source code, it looks like the USPS form is a javascript under the covers. I've not been able to figure out the expression I need to build to match my database fields with USPS's zip code look-up fields. I can get the form to display in the webviewer by adding the URL to the expression ("http://zip4.usps.com/zip4/") and that's better than switching back and forth between a browser and the database, but it would nice to be able to skip the cut and paste or retyping to fillout out the USPS form. (If that could be done, parsing the resulting zip-4 code back to the zipcode field would be a neat second trick :) If anyone has a solution for this expression, please share. Thanks!

Link to comment
Share on other sites

  • 2 months later...

I would love to figure out how to do this as well, either with the Web Viewer or some other method. It seems as though you can only use Web Viewer for sites that can pass field data in the URL, and like the original poster said, USPS.com keeps that hidden.

Link to comment
Share on other sites

Finally - a question that I can figure out!

Almost any "form" that is on a web site can be broken down into its input components. If you view the source for this page, you will see what I mean (just search for the form HTML tag -

. These input tags correspond to the input fields on the web page, and some input fields are hidden.

For this particular page, the form components are:

FORM NAME: http://zip4.usps.com/zip4/zcl_0_results.jsp

Input Fields (the first three are "hidden"):

(I have manually put in information after these field names. Also, I added the ampersand & to the beginning of each field - you will see why later)

&visited=1

&pagenumber=0

&firmname=

&address1="1207 Pine Needle Dr"

&address2=

&city=PERRY

&state=GA

&urbanization=

&zip5=

&submit

You only need three fields - address1, city and state to get a result.

So, once you have created the same fields (as shown above) in your database, you then create a calculation field that takes the above HTML and strings it together like so:

http://zip4.usps.com/zip4/zcl_0_results.jsp?&visited=1&pagenumber=0&firmname=&address1=1207%20Pine%20Needle%20Dr&address2=&city=PERRY&state=GA&urbanization=&zip5=&submit

The key is the "?" after the zcl_0_results.jsp - as this tells that program (zcl_0_results.jsp) to take the rest of the line and break it down into its components, and then process your request. That is why you need the ampersand "&" after each field name - this is the separator for each field.

BE SURE to substitute any spaces for %20 (%20 is the HTML version of a space when you type a space in the address field of your browser). If you don't use any other special characters, you won't have to translate them into HTML. In fact, the web viewer might even translate the spaces and special characters for you.

I tested it, and it appears to work. You will have to work on parsing the results...

Thanks,

Tony

Link to comment
Share on other sites

This topic is 6436 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.