Jul-28-2019, 01:30 AM
Hi, I'm currently doing some testing if possible to build like a webserver that print outs the result from a script that was based from CLI?
I have run this command, but when I click the script it just show the source code but did not run the script. Anyone here tried building a simple script like ping from shell then print output from CGI(Web),=..
Currently using the default python v2.6 on our linux server and I have no privilledge to download new module etc since my account is not sudoer so I have to stick on whats avilable right now... Is this possible?
Any document for this? Should I build first a html code the call the python script? should I use .py or .exe. thats the common thing that I observe... tho still searching how to build a basic script for cgi.
Tried using this as sample, but after input from webtest.htm once I click the submit it just print the source code of hello.py.
webtest.htm
I have run this command, but when I click the script it just show the source code but did not run the script. Anyone here tried building a simple script like ping from shell then print output from CGI(Web),=..
Currently using the default python v2.6 on our linux server and I have no privilledge to download new module etc since my account is not sudoer so I have to stick on whats avilable right now... Is this possible?
Any document for this? Should I build first a html code the call the python script? should I use .py or .exe. thats the common thing that I observe... tho still searching how to build a basic script for cgi.
Tried using this as sample, but after input from webtest.htm once I click the submit it just print the source code of hello.py.
webtest.htm
<html><body> <form method="get" action="/draft/cgi-bin/hello.py"> Name: <input type="text" name="name"> <input type="submit" value="Submit"> </form> </body></html>hello.py
#!/usr/bin/env python import cgi form = cgi.FieldStorage() name = form.getfirst("name") print "Content-type:text/html\r\n\r\n" print "<html>" print "<body>" print '<h1>Hello ' + name + '! This is a test!</h1><br />' print '</body>' print '</html>'