Top Forums Shell Programming and Scripting Trying to submit web form content to a shell script Post 303018199 by Paul Walker on Thursday 31st of May 2018 11:37:35 AM
Trying to submit web form content to a shell script

Hi I was hoping some one could help me with a problem I have.
I am trying to collect some information from a web form and save it to a text file.
I found an example on this site that is sort of what I am trying to accomplish, the shell script bellow should echo the input back to the browser but I dont seem to be able to make the example scripts and form work on my system. I am working on a mac running El Capitan 10.11.6.

The example uses the korn shell but I have change it to bash on my system.

the code for the form is
<html><head><title>Test Form</title></head>
  <form action="/cgi-bin/test.cgi" method="get">
    input for GET: <input name="get_input">
    <input type=submit value="Submit via GET">
  <form action="/cgi-bin/test.cgi" method="post">
    input for POST: <input name="post_input">
    <input type=submit value="Submit via POST">

the code for the shell script is
 print "Content-type: text/plain\r\n\r"
print "my query string from (GET) is \"$QUERY_STRING\""
print "\nmy stdin (from POST) is"

I get a couple of different errors when I submit the form through my browser
one is
You don't have permission to access /test.cgi on this server.
Apache Server at Port 80

Not Found
The requested URL /cgi-bin/test.cgi was not found on this server.
Apache Server at Port 80

I have tried placing the test.cgi script in the same directory as my html page and and I get the permissions error. When I move the test.cgi script to my /Library/WebServer/CGI-Executables folder and point the form action towards that folder I get a 404 error.
Do I need to change anything in Apache to be able to run cgi scripts?
All I want to do is collect the form data to a text file and without having to use php or python.
If I was able to accomplish this with perl or awk or any shell program that would be great.
I would be very grateful for any help you could give me with this problem.
Test Your Knowledge in Computers #799
Difficulty: Medium
In digital numeral systems, the radix is the number of unique digits minus 1.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PHP Help with Form Submit

Hi, I have a custom HTML form that has a couple radio buttons and a text field that requires a number. I'm not a php programmer and could use some help with putting together php code to calculate a total based on the radio button selection and the text field number. ... (3 Replies)
Discussion started by: nck
3 Replies

2. Shell Programming and Scripting

using wget to submit a form on linksys router

I'm trying to use wget to submit a form. I have tried to dig out what is actually being "posted" and where, using tamperdata (see below). Here is my wget command: wget --http-user=xyz --http-password=xyz... (1 Reply)
Discussion started by: mike909
1 Replies

3. Shell Programming and Scripting

Filling out Web Form from Script

I am trying to fill out a web form from within a script I am writing. I think that I should be using curl to do this, but I'm not really sure. The form has username and password fields and a submit button. I want to be able to log in from the command line. Html from the site: <h5... (2 Replies)
Discussion started by: vockleya
2 Replies

4. Shell Programming and Scripting

Pass values from web form to shell script

Hi, is it possible to pass more values from web form like textbox to shell script and if yes,how to do that.:confused::confused::confused: (2 Replies)
Discussion started by: tdev457
2 Replies

5. Shell Programming and Scripting

Using cURL to submit a post form

I am trying to write a shell script to use curl in order to automate downloading data from a website. The URL with the post form is here: . I have a list of about 1800 different species I want to check. For Example, choose the first species and use the... (2 Replies)
Discussion started by: hansvg
2 Replies

6. Shell Programming and Scripting

Can't submit a form.

hello my script is submitting POST-data to a site (its not my first script, i've done these before many times (include parsing scripts) but this one is tough) so the problem is i'm submitting a form with firefox and in firebug i see WHAT exactly i'm submitting then when i do EXACTLY the... (28 Replies)
Discussion started by: tip78
28 Replies

7. UNIX for Dummies Questions & Answers

How to submit form on an php webpage from command line?

Hello, i have page the form fields on form.php are named: name=ipaddress name=port and submit button is named: submit i want to ask how the linux command will look like to submit the form filled with: ipaddress: port: 80 I tried various curl and... (5 Replies)
Discussion started by: postcd
5 Replies

8. Web Development

Apache2 web application- Submit button - write data into a file

Hello, I am newbie on php-mysql and just know only installation. I have an apache2+php5+mysql installed VPS. What I would like to do is that when visitor enters requested data shown in index.html, submit button will run a script to save each field into a file. Here is an example shown in... (1 Reply)
Discussion started by: baris35
1 Replies

9. Programming

Html form to submit data to bash script

hi all, im going to design a web html form so users can input what username and password they want to make the ftp account, once they enter in a username and password they click on the submit button and it submits it to a bash script and then the bash script will run and finish of making the... (3 Replies)
Discussion started by: robertkwild
3 Replies

10. Shell Programming and Scripting

Exec submit form in bash script

Hi All, I'm new in forum. Many congratulations to everyone for all work. I'm not an expert in bash script I've a problem with a sh file. The sh file run every t minuts and it read data from txt file and then compile form. Finally, the user, from the web browser click on send. The script... (0 Replies)
Discussion started by: Herbert
0 Replies
DPKG-WWW(1)						      General Commands Manual						       DPKG-WWW(1)

dpkg-www - program to remotely open a WWW Debian package browser SYNOPSIS
dpkg-www [-s|--stdout] [-h|--host host] [query] DESCRIPTION
dpkg-www is used to remotely control a WEB browser and open a dpkg URL on the local host from an interactive shell or script. If the command is invoked while running under X-window the script will try to find an installed X browser to open the specified URL. If not running under X it will try to use a text browser instead. If Netscape is found and a Netscape instance is already running it will be asked to open the dpkg URL on localhost with the optional query supplied on the command line. If there is no browser running, it will start automatically a new one. The functionality provided by this program is identical to running a web browser with the -remote openURL(http://localhost/cgi-bin/dpkg) argument or opening the same URL from within the browser. dpkg-www-installer is an helper application which can configured in the WWW browser for web installation. It should never be invoked directly by the user. OPTIONS
-s, --stdout Redirect output to stdout. Requires one of the text browsers (lynx, lynx-ssl or links) installed. -h, --host host Send the query to a remote host, where dpkg-www must be installed. query Specifies an optional package name, an absolute pathname or a query argument which is passed to the dpkg cgi-bin. See dpkg-www(8) for more information about the use of the cgi. FILES
/etc/dpkg-www.conf ~/.dpkg-www Configuration files for dpkg-www. It is not necessary for these files to exist, there are sensible defaults for everything, but you can specify your preferred www browser with the DPKG_WWW_BROWSER variable, for example: DPKG_WWW_BROWSER=mozilla EXAMPLES
dpkg-www This would open a dpkg URL on localhost listing all the installed packages. dpkg-www bash This would open a dpkg URL asking info on the bash package. dpkg-www -h pisolo bash This would open a dpkg URL asking info on the bash package on host pisolo. dpkg-www 'dpkg*' This would open a dpkg URL listing all packages matching dpkg*. dpkg-www /bin/bash This would open a dpkg URL asking info on the package(s) owning the file /bin/bash . dpkg-www depends=svgalib This would open a dpkg URL listing all packages depending on svgalib. dpkg-www --stdout depends=awk | grep ^ii This would list on stdout all packages depending on awk and grep all lines of installed packages. SEE ALSO
dpkg(8), dpkg-www(8) AUTHOR
Massimo Dal Zotto <>. Bugs should be reported via the normal Debian bug reporting system. LICENCE
dpkg-www is licensed under the GNU General Public License version 2. September 1, 2004 DPKG-WWW(1)

Featured Tech Videos

All times are GMT -4. The time now is 11:52 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy