Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Passing cgi parameters to script...

Reply
Thread Tools

Passing cgi parameters to script...

 
 
sophie_newbie
Guest
Posts: n/a
 
      12-29-2005
Is there any way that I can pass cgi parameters to my script locally,
before i upload it to the webserver, so that i can debug it.

Normally I would pass parameters like this:

http://www.webserver.com/script.cgi?...by&FIELD2=GOVT

The problem is that I get errors that do not show up when I run the
script locally and I do not have access to the error logs.

So is there a way I can pass the form values TERM1, FIELD1 etc to the
script without having to upload it to the server?

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      12-29-2005
sophie_newbie wrote:

> Is there any way that I can pass cgi parameters to my script locally,
> before i upload it to the webserver, so that i can debug it.
>
> Normally I would pass parameters like this:
>
>

http://www.webserver.com/script.cgi?...by&FIELD2=GOVT
>
> The problem is that I get errors that do not show up when I run the
> script locally and I do not have access to the error logs.
>
> So is there a way I can pass the form values TERM1, FIELD1 etc to the
> script without having to upload it to the server?



You might think of using CGIHttpServer to test your scripts in a
server-environment - while still being local.

Regards,

Diez
 
Reply With Quote
 
 
 
 
Mike Meyer
Guest
Posts: n/a
 
      12-29-2005
"sophie_newbie" <(E-Mail Removed)> writes:
> Is there any way that I can pass cgi parameters to my script locally,
> before i upload it to the webserver, so that i can debug it.
>
> Normally I would pass parameters like this:
>
> http://www.webserver.com/script.cgi?...by&FIELD2=GOVT


CGI paramaters are set in the environment. On Unix, in an sh-like
shell, do:

QUERY_STRING='TERM1=hello&FIELD1=TTL&TERM2=goodby& FIELD2=GOVT' www.webserver.com/script.cgi

Depending on the package you're using for handling CGI, you may need
to set other CGI parameters as well. The traceback from trying this
should give you a KeyError naming the environment variable it's
looking for.

<mike
--
Mike Meyer <(E-Mail Removed)> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
 
Reply With Quote
 
Kent Johnson
Guest
Posts: n/a
 
      12-30-2005
Diez B. Roggisch wrote:
> sophie_newbie wrote:
>
>>Is there any way that I can pass cgi parameters to my script locally,
>>before i upload it to the webserver, so that i can debug it.

>
> You might think of using CGIHttpServer to test your scripts in a
> server-environment - while still being local.


Which can be as simple as typing
python -c "import CGIHTTPServer; CGIHTTPServer.test()"

from the command line in the root dir of your site (the dir that
contains the cgi-bin dir).

Kent
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameters to an executable vs. passing them to a server Ramon F Herrera C++ 8 09-13-2009 02:48 AM
passing parameters from xsl to cgi script lievemario Perl Misc 4 11-23-2004 09:01 PM
passing parameters from xsl to cgi script lievemario XML 2 11-23-2004 03:05 PM
Passing in CGI parameters to an .rhtml file with StringIO#instance_eval Francis Hwang Ruby 2 10-07-2004 07:50 PM
Servlet parameters different from the command line parameters? Jonck van der Kogel Java 2 05-26-2004 11:34 PM



Advertisments