Project

General

Profile

Configure CGI script » History » Version 2

Rob Tjalma, 08/26/2016 11:45 AM

1 1 Rob Tjalma
h1. Configure CGI script
2 1 Rob Tjalma
3 1 Rob Tjalma
Instructions about how to create a CGI script for connecting to the SQLite database.
4 1 Rob Tjalma
5 1 Rob Tjalma
h3. Script example
6 1 Rob Tjalma
7 1 Rob Tjalma
<pre>
8 1 Rob Tjalma
#!/bin/bash
9 1 Rob Tjalma
10 1 Rob Tjalma
echo
11 1 Rob Tjalma
12 1 Rob Tjalma
QUERY_STRING = "$QUERY_STRING"
13 1 Rob Tjalma
14 1 Rob Tjalma
python file.py $QUERY_STRING@
15 1 Rob Tjalma
</pre>
16 1 Rob Tjalma
17 1 Rob Tjalma
Very easy CGI script.
18 1 Rob Tjalma
The *QUERY_STRING* variable contains all the query parameters in the URL. 
19 1 Rob Tjalma
20 1 Rob Tjalma
_Example:_
21 2 Rob Tjalma
<pre>http://example.example/webservice/test.cgi?q=value&callback=function</pre>
22 1 Rob Tjalma
23 1 Rob Tjalma
*QUERY_STRING* will give you:
24 2 Rob Tjalma
<pre>q=value&callback=function</pre>
25 1 Rob Tjalma
26 1 Rob Tjalma
The python file in the repository takes one argument, the *QUERY_STRING* value.