EE-WBC Assignment 13

Program 1 (60pts.)

Write a CGI script that interfaces to a Web-accessible networked resource mapped to the URL of http://gdansk.bradley.edu/olekmali/cgi/p_cgi_hw04.pl that extracts certain data from the plain text file transmitted over the HTTP protocol and displays on a Web page.

The CGI script should be triggered by a button in an HTML form. In addition to that button the form should have two mutually exclusive choices of English (F miles, mph, in Hg) and Metric (C, km, kmph, hPa) units. Depending on that setting the CGI script should generate a narrative report using appropirate data.

When a Web accessible data resource foresaid above is contacted using HTTP protocol it would respond in one of two possible ways:
 

Content-Type: text/plain; charset=ISO-8859-1
Pragma: no-cache

N/A - Not Ready, try again

or
 
Content-Type: text/plain; charset=ISO-8859-1
Pragma: no-cache

Peoria, Illinois

10
9
93
29.77 in 1008 hPa (Falling)
22
East
12.9

 

93
29.77 in 1008 hPa (Falling)
14
East
8.0


Overcast

Note that the data changes with time. In case you encounter the first kind of reply you should retry accessing it every one second (use function sleep(1) to wait for one second) until you receive the second kind of reply but only up to ten times. Once you get the valid data your job is to extract apprpriate data and display with units on the Web page generated by your CGI script. The meaning of valid data is as follows:
 
place

temperature_celsius
dewpoint_celsius
humidity
pressure
wind_kilometersperhour
wind_direction
visibility_kilometers

temperature_fahrenheit 
dewpoint_fahrenheit
humidity
pressure
wind_milesperhour
wind_direction
visibility_miles


conditions
 

In case you cannot connect to the Web accessible resource, or if ten or more connections return data not available response display a nice descriptive error message to a user.

Homework Submission

Attach all source code in files with proper names and extensions (*.html, *.java, *.pl, *.php, .htaccess e.t.c.). Do not ZIP files together or include compiled files (e.g. *.class). In case of dynamic Web pages (JavaScript or CGI) or Java applets also send the complete URL (including http://) that points to a page on your Web site that demonstrates your homework. Send your homework via e- mail to the instructor at olekmali at bradley dot edu. Please set the message subject to: web-hwC.

Thank you.

web site front local main page local list page print this page   general bookmarks software bookmarks go back close this page copyright info   visitor counter