Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

How to do CGI POST as client?

 [1/3] from: dud::monmouth::com at: 13-Dec-2000 14:06

Folks, I've tried to create a simple script that submits a filled out form to a CGI server, but the server access log only shows a GET, not a POST operation. Is the "read/custom . . . post" construct broken? I saw an earlier query on the rebol-list archives asking a similar question but no reply to it (or I wouldn't have bothered you. This script should do a query of a database and return with an answer. Instead, it just returns the original form as if the POST didn't happen. (And that's what apache's access_log on the web server shows.) Thanks, Bill Dudley Monmouth Internet P.S. script below. REBOL[ Title: "dud's test" Date: cvs-date "$Date: 2000/12/13 13:53:35 $" ;Version: "$Revision: 1.0 $" Rights: "Copyright (C) William Dudley 2000" ] sites: [ [ url: ] ] foreach site sites [ do site result: read/custom url [ post {npa="732"&nxx="842"&process="Lookup"} ] tag-text: load/markup result text: make string! 2000 foreach item tag-text [ if string? item [append text item] ] print text print url print {npa="732"&nxx="842"&process="Lookup"} ]

 [2/3] from: sterling:rebol at: 13-Dec-2000 13:45

You had it except you added quotes around Lookup. Change this line:
> result: read/custom url [ post {npa="732"&nxx="842"&process="Lookup"} ]
> result: read/custom url [ post {npa="732"&nxx="842"&process=Lookup} ]
and you'll be fine. Sterling

 [3/3] from: dud:monmouth at: 13-Dec-2000 17:09

Sterling, Thanks for the reply, but . . . that doesn't seem to fix it. (Incidentally, I'm running the latest rebol for FreeBSD. Pity that rebol -v doesn't print a version number. Anyway, even without the quotes, the server is not seeing this as a POST operation: Here's the log entry after I just tried it without the quotes: (folded for readability) - - [13/Dec/2000:16:57:29 -0500] GET /cgi-bin/cgiwrap/dud/dsl.cgi HTTP/1.0 200 1683 This script should run from anywhere on earth, and if you get a list of phone exchanges, like this: 609 718 732 856 908 914 917 973 Then the rebol script is not working (i.e. not doing a POST). I can't show you exactly what you'll see if it does work (because I can't get it to work) but if I capture the correct output from my browser, it looks something like this: Welcome to the Monmouth Internet DSL Query Page Area Code: 732 Exchange: 842 Central Office: RED BANK NJ CLLI: RDBKNJRB Rhythms: 17-Nov-1999 All dates are estimated dates of availability which have been provided by the vendors. Bill Dudley Monmouth Internet