Get parameters from URL using CGI
John Zenger
john_zenger at yahoo.com
Sun Feb 19 09:17:23 EST 2006
import cgi
import cgitb; cgitb.enable() # Optional; for debugging only
print "Content-Type: text/html"
print
f = cgi.FieldStorage()
for i in f.keys():
print "<p>",i,":",f[i].value
abcd wrote:
> i want to create a CGI script which simply prints out values given via
> the URL (such as when a GET is performed).
>
> So if I have a script named, foo.cgi ....and I access it by going to:
>
> http://www.somesite.com/cgi-bin/foo.cgi?name=john&age=90
>
> I want foo.cgi to print out:
> name: john
> age: 90
>
>
> how do i get the values from the URL like that?
>
> thanks
>
More information about the Python-list
mailing list