tips on posting an url and reading the results

Peter M. Brigham, MD pmbrig at gmail.com
Fri Feb 3 11:36:18 EST 2012


On Feb 3, 2012, at 4:39 AM, Nicolas Cueto wrote:

> Hello All,
> 
> Just got a barcode scanner, confirmed it works with LiveCode, and now
> want to play.
> 
> But, being impatient (or lazy), am hoping for some pointers about the
> LC commands I should look into to do the following from within a
> stack.
> 
> First, how to get my stack to post an ISBN number to an online ISBN-
> lookup. For example:
> 
> https://www.google.com/search?tbo=p&tbm=bks&q=isbn:9784883194292&num=10
> 
> Then, how to get my stack to "read" the results of that ISBN-lookup.
> 
> Much welcome too would be advice about combing thru the HTML mess that
> gets returned in order to find only the info I'm after.

Try something like this:

put "xxxxxxxx" into tISBNnbr
put "https://www.google.com/search?tbo=p&tbm=bks&q=isbn:<ISBN>&num=10" \
          into tURL -- could store this as a customprop for general use
replace "<ISBN>" with tISBNnbr in tURL
put url tURL into tHTML

and tHTML will contain the HTML for the google page, and you can parse this for what you want. What are you looking for? Parsing text strings is actually very easy and powerful in LC, once you get the hang of it -- you can extract pretty much anything you want.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list