Writing to a web site?

Dave Cragg dcragg at lacscentre.co.uk
Mon Apr 11 08:39:45 EDT 2005


On 11 Apr 2005, at 12:23, Jim Hurley wrote:

> This is something that is new to me and I have no understanding of the 
> options.
>
> I have considered using Run Rev to get the 4 additional numbers in zip 
> codes.
>
> At the site
>
> 	http://scikits.com/lookup.html (or 
> http://zip4.usps.com/zip4/welcome.jsp)
>
> one can enter an address such as 123 Broad St, 95959 and receive a 
> reply:
>
> 	123 BROAD ST
> 	NEVADA CITY CA 95959-2623
>
> But the web site that offers this results is listed as:
>
> 	http://zip4.usps.com/zip4/zip4_responseA.jsp
>
> Needless to say, there is no web site for every address.
>
> So there appears to be no option to simply call up a web site and 
> parse the results. It seems that the only option would be able to 
> Write to a web site (at least to site which present this option) as 
> well as Read from the site. Seems unlikely.
>
> Does Run Rev offer any options in this circumstance?
>

I'm not sure if I understand what you want to do. You can use the post 
command to use the url described above. This basically emulates the 
form submission of the webpage. (You have to look through the raw 
source of the webpage to find the necessary form field values.) For 
example, the following script uses your example address to put the 
webpage normally returned into field 1.

on mouseUp
   put empty into field 1

   put "Selection=" & 1 after tQuery
   put "&" after tQuery
   put "address1=" & urlEncode("123 BROAD ST") after tQuery
   put "&" after tQuery
   put "zipcode=" & 95959 after tQuery

   put  "http://zip4.usps.com/zip4/zip4_responseA.jsp" into tUrl

   post tQuery to url tUrl
   if the result <> empty then
     answer the result
   else
     set the htmltext of field 1 to  it
   end if

end mouseUp


Cheers
Dave



More information about the use-livecode mailing list