POST variables to CGI via URL with URLencoded string fails??

Dave Cragg dcragg at lacscentre.co.uk
Fri Oct 17 05:03:44 EDT 2003


At 2:07 pm -1000 16/10/03, Sannyasin Sivakatirswami wrote:
>I have a simple CGI running that  receives subscription requests to
>our Hindu Press International mailing list.
>
>Odd thing is... if I post the name and email address (only two
>fields in this form) to the CGI from a web form.. it works..
>
>but if we try to post the same two values via a standard URL, with
>the input values appended in the normal way a URLencoded string, the
>CGI does respond, but it tells us that standardIn is returning
>empty??
>
>The beginning of the CGI is straightforward:
>
>on startup
>     read from stdin until empty
>     put it into temp
>put  urlDecode (it)  into tDataIn
>put tDataIn into tRemit
>      split tDataIn by "&" and "="
>   put isWellFormedMailtoScheme (tDataIn ["email"]) into emailCheck
>    switch emailCheck
>
>  ##  etc. process the subscription.. only two values expected, name
>and email address...
>
>But this:
>
>http://www.hinduismtoday.com/cgi-bin/
>send_sub_request.cgi?name=Aloha+test&email=jiva%40hindu.org
>
>doesn't work... standardIn returns empty.

In this case you should be using GET not POST.

On the server side, your script shouldn't be reading from the socket; 
that will only get posted data, and in this case there is none. 
Instead, it should be getting the $QUERY_STRING environment variable 
which should contain this:

name=Aloha+test&email=jiva%40hindu.org

Cheers
Dave


More information about the Use-livecode mailing list