Writing Data with Shockwave and CGIs

Date: Tue, 9 Jan 1996 08:46:11 -0700
From: Alan Levine <levine@MARICOPA.EDU>
Subject: Re: SW: getNetText & cgi?

>Can getNetText/NetTextResult be used in a Shockwave movie to "submit"
>some text to a cgi and then receive a text result back?
Yes... as always, with caveats.

We have done this as a demo- the Shockwave Poll:

  http://www.mcli.dist.maricopa.edu/alan/nojava/poll/
The idea was to have a shockwave page read in a text file (getNetText) with the results ofaan online survey and then animate a bar chart with the results. It would have been neat to see this dynamically update if someone else was voting at the same time.

Originally we wrote a normal web page FORM with a cgi that takes the votes and then updates them to a text file on our server.

But you can also have your shockwave movie talk directly to the cgi by using:

  gotonetpage http://www.abc.com/cgi-bin/myscript?choice=3&name=barney+rubble
where everything after the ? are the variables and values sent to the cgi normally by a web page form. The hitch comes in constructing that data stream- all spaces are converted to "+", and you have to watch our for other special characters like "&", and the QUOTE.

You can figure out what this stream looks like if you contruct an HTML form and rather then using

   ACTION="http://www.abc.com/cgi-bin/myscript"
in the <FORM> tag, substitute
  ACTION="mailto:me@abc.com"
so that when you test the form on a web browser, it will e-mail you the string of gunk normally sent to the cgi-script.

This is the rub- in our movie as soon as you open it, it reads the data file via getNetText, getting it from our web server. IF you run a CGI that writes new information to that file and then do another getNetText-- NOTHING changes because rather than reading the file from the server, getNetText now just pulls it from your cache (which has not been updated). The only way you will get a fresh file from the server is to quite NetScape and restart, or to trash your cache. (this also goes for testing of .dcr files- if you upload a new version, your brower keeps yanking the old one from cache) So, Macromedia Shockwave team is hopefully looking at a way to force a new read from the server. I would think this is critical to create multi-user environments.

That is, unless the goal of shockwave is no more than spinning logos.