Web scripts / Web services

Web Scripts

A lot of web content is *not* assembled directly by humans, but is generated by computer software. Sometimes the software creates web files (say once a day),

massive press release listing: parch-all.html

and sometimes visiting a particular URL might cause a program to run right at that instant to generate a web page for you at that instant.

Current weather in Goshen

Controlling what a script does

Many web scripts will generate different output depending on the input you give it.

Usually, behind most web forms there is a web script that processes what people type in. After you've submitted a form, take a look at the URL, and you'll see that often (not always) it has a "?" in it, and then some things related to the form you just filled out:

http://www.goshen.edu/search/peoplefinder.php?words=Brenneman

This is one way of passing variables and values to a script...via the URL. In fact, you can control how such a script works without using a form. Try changing the URL above to search for somebody else.

More examples...

gconline.goshen.edu/public/prod/eventcal/bin/?dCategory=sports&dSubcat=track-M

Latest news about Fidel Castro

Note the syntax,

Dynamic content

All of the examples above will give you up-to-date content. Without having to change the URL on this page, following the link will produce information specific to the day a visitor goes to that page. There's no need to change the URL in the link each day to get that benefit.

Forms

Of course, it would be silly and very trying to expect visitors to your site to interact with scripts by manually editing a URL to get different kinds of content. Who knows (without being told) what the possible variables, and what the possible values are that a script can deal with? A web form plays the role of switchboard operator--offering a more friendly way for visitors to a site to be able to take advantage of some script.

Here are two forms that interact with the scripts above....

Sports this month at GC

Peoplefinder

Name:

Web Services

The script examples above all generated a whole web page.

But it would be no problem to write a script that generates just a snippet or chunk of HTML instead. For example:

GC calendar service: Art this month

If we just had a way (it's called php!) to suck that HTML into a page of our own, we could create a page like this that uses our page's styles, but always has up-to-date content: