how to run python scripts on a website

P

py

i have a website which runs apache on linux. it supports python (i
think via cgi....not sure how else). anyway how can I go to a web page
and run a python script or something like that? for example say i make
a script which prints out all the links on another URL....how can i run
that?


thanks!
 
J

James Stroud

py said:
i have a website which runs apache on linux. it supports python (i
think via cgi....not sure how else). anyway how can I go to a web page
and run a python script or something like that? for example say i make
a script which prints out all the links on another URL....how can i run
that?


thanks!

Here is a start. Put the following in your cgi-bin folder or equivalent.
Name it test.cgi


#!/usr/bin/python

print "Content-Type: text/plain\n\n"
print "Hello, World!\n"


Now just browse it. E.g.:

http://www.doe-mbi.ucla.edu/cgi/jstroud/ex-1.1.cgi


James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top