Script 6

Presentation Notes

Now that we have the baseURL and the search terms, we need to actually request the results page.

Notice that the results page contains links to more information? When we actually process this page, we could follow those URLs and get information from them as well. Here it would include a picture (possibly) and more details about each dog, like whether they are cat-friendly, etc.

Script Source

property searchBase : "http://www.petfinder.com/pet.cgi"

property searchTerms : "action=1&pet.Animal=Dog&pet.Breed=malamute&pet.Age=Adult&pet.Size=&pet.Sex=M&location=NJ"

-- get the source as a string

set sourceHTML to (do shell script "curl " & quoted form of searchBase & " --data '" & searchTerms & "' | vis")

-- "curl 'http://www.petfinder.com/pet.cgi' --data 'action=1&pet.Animal=Dog&pet.Breed=malamute&pet.Age=Adult&pet.Size=&pet.Sex=M&location=NJ' | vis"

sourceHTML