cgi post

Magnus L. Hetland mlh at idt.ntnu.no
Sun Sep 5 13:15:45 EDT 1999


vijay Mallela <vijaym at netscape.com> writes:

> how do i do something like this in a python cgi script:
> 
> form = cgi.fieldstorage()
> if form['foo'] == 'bar':
>     loadhttp('spam.com')
> please let me know if there is a way to do this..
> 
> Right now, I am opening the file and spam.com and then printing it..
> what if the file is some where else and I would like to direct the user
> to that site..

Just print a header like this:

Content-type: text/html
Location: spam.com

The user will then be redirected to spam.com without any problems.
(Remember the empty line after spam.com, though... Even if you aren't
printing anything else)

> 
> Thanks
> v
> 

--

  Magnus              Making no sound / Yet smouldering with passion
  Lie          The firefly is still sadder / Than the moaning insect
  Hetland                                       : Minamoto Shigeyuki




More information about the Python-list mailing list