March 2012
Intermediate to advanced
392 pages
10h 17m
English
Webbots are sometimes easier to use when they’re packaged as functions. These functions are simply interfaces to webbots that download and parse information and return the desired data in a predefined structure. For example, the National Oceanic and Atmospheric Association (NOAA) provides weather forecasts on its website (http://www.noaa.gov). You could write a function to execute a webbot that downloads and parses a forecast. This interface could also return the forecast in an array, as shown in Example 16-1.
Example 16-1. Simplifying webbot use by creating a function interface
# Get weather forecast $forcast_array = get_noaa_forecast($zip=89109); # Display forecast echo $forcast_array['MONDAY']['TEMPERATURE']." ...
Read now
Unlock full access