cgi

Python script does not run through CGI on Apache2

北城余情 提交于 2019-12-13 17:42:37
问题 I am using apache2 version Apache/2.4.23 I created a simple python script that I want executed via CGI. The script does not execute when I open http://localhost/cgi-bin/hello.py. Instead, I just see the python code in the script: The script looks like so: #!/usr/local/bin/python print "Python ok!" The rights on the script are set to -rwxr-xr-x (755). This python script resides in /Library/WebServer/CGI-Executables/ . I have configured the ScriptAlias in my httpd.conf like so: ... ScriptAlias

How to print the variables of an array as checkbox names in a cgi-form?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 09:56:13
问题 Is there a simple way to print check boxes in an cgi form whose names are variables of an array? 回答1: You have several problems. If you want to pass multiple values to a single property in a hash, then you need to pass a reference . Your code (before you deleted it from the question during the grace period when edits are not recorded) will be interpreted as: checkbox("-values" -> "apple", "orange" => "berry") . checkbox only takes one value. If you want to pass multiple, then you need to call

ValueError: invalid literal for int() with base 10: '' python [closed]

拜拜、爱过 提交于 2019-12-13 09:25:38
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . ValueError: invalid literal for int() with base 10: '' Why it showing the error of int(), in fact the values coming from the cgi is as string which i am converting it to integer, bcoz my comparable part variable actual_ans_dict contains an integer res12 = form.getvalue('opt_12', '') res27 = form.getvalue('opt_27

Have the address of the client in python

情到浓时终转凉″ 提交于 2019-12-13 09:01:23
问题 My request is : I have my web pages created in python (wherein there is html code), each pages has a button to go to the next page. Is it possible to get the address of the client when we submit an html form for example ? I mean, to have into the URL address of the client. If that possible, I'll show my code, else I delete my question. that's my html code : ip = cgi.escape(os.environ["REMOTE_ADDR"]) <html> path install: ${install_path}<br/><br/> os: ${os}<br/><br/> unix user: ${user_name}<br/

How can I iterate through all checked values of a checkbox group in a Perl CGI script?

旧巷老猫 提交于 2019-12-13 08:39:20
问题 I have an xampp test system setup running on a Windows machine. I have a small command line application I would like to trigger using a Perl CGI script. I have a form that I created using Perl. There are a number of check boxes as well as an input box where a user can type a message. Here is the code that I have so far. I am not an expert in perl by any means, so there might be a few things in here that don't make sense, or are for testing purposes #!"C:\xampp\perl\bin\perl.exe" #print a

inets httpd cgi script: How do you retrieve json data?

孤街醉人 提交于 2019-12-13 08:21:34
问题 The cgi scripts that I have tried are unable to retrieve json data from my inets httpd server. In order to retrieve json data in a cgi script, you need to be able to read the body of the request, which will contain something like: {"a": 1, "b": 2} With a perl cgi script, I can read the body of a request like this: my $cgi = CGI->new; my $req_body = $cgi->param('POSTDATA'); I assume that is an indirect way of reading what the server pipes to the script's stdin because in a python cgi script I

How do I get selected value from drop down box in Perl CGI

时间秒杀一切 提交于 2019-12-13 06:02:51
问题 I am populating the drop down menu from database. And when I submit the form I am getting empty string in selected option. Here's my code any help will be appreciated. I have selected the first option as default any help. print "<br>Name: <select>"; while ( my ($name) = fetchrow_array() ) { if ($name eq "Somethinge") { print "<option value=\"$name\" selected>" . $name . "</option>\n"; }else { print "<option value=\"$name\">" . $name . "</option>\n"; } } print "</select>"; I am getting the

Python cookie is either not saved or somehow not accessible to CGI script

我与影子孤独终老i 提交于 2019-12-13 05:41:58
问题 I think this is going to have an obvious answer... I've been looking at a bunch of examples of cookies in Python and have gathered that the proper order to present things is: get the cookie if it exists, set cookie data, print the content type header, output the cookie, and then print everything else. I've built this up in small parts and I can't tell what's making this version not work. It does create a cookie (with a string of numbers, as far as I can see in Firefox/Chrome) but it doesn't

Bash cgi upload file

此生再无相见时 提交于 2019-12-13 05:02:37
问题 Hello i have such problem. I have html <form action="/cgi-bin/echo.cgi" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> And i need to write this file from form to server using bash cgi(not perl). I try something like this POST=$(</dev/stdin) echo "$POST">"/tmp/a" but it doesn't work P.S. i see this in apache log /var/www/cgi-bin/echo.cgi: line 6: /dev/stdin

Calling a Python script from a webpage

不羁的心 提交于 2019-12-13 04:58:06
问题 I've searched around for a while but I can't find a concise explanation of how to do what I want. I have a fairly complex program which I'd like to make a simple web interface for. Ideally there'll be a couple of text fields, "foo" and "bar" on a webpage. When the user clicks submit, a python script "src/script.py" is run, which has access to the contents of these fields somehow. I have apache2 and mod_python. 回答1: If it is a "fairly complex program" you may want to use a small framework that