Nine digit zip codes
ambassador at fourthworld.com
Sat Nov 27 12:11:49 CST 2010
James Hurley wrote:
> At the USPS web site (http://zip4.usps.com/zip4/) it is possible by
> entering the street address, the city and the state to obtain the 9
> digit zip code for that address.
> This may be naive, but is it possible to do this from within LiveCode
> by script?
Good news: you can use the post command for that.
Bad news: the result is HTML, so you'll need to parse out the relevant
To test I made a stack with a button and two fields - here's the script
for the button, using the URL derived from the HTML source of the form
element in that page:
post fld 1 to url "http://zip4.usps.com/zip4/zcl_0_results.jsp"
set the htmlText of fld 2 to it
Field 1 contains form element names and values, packaged up in the
name=value format used by both POST and GET:
Field 2 will contain the HTML once the request is returned. Now for the
tedious parsing to get the parts you want....
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
More information about the use-livecode