Save the below content to /www/cgi-bin/test.cgi Then access the URL http://192.168.1.1/cgi-bin/test.cgi You should see the environment vars.
These could be used in your script for logic.
You can take it a step further and add parameters to the get request and then parse them out of QUERY_STRING. Something like: http://192.168.1.1/cgi-bin/test.cgi?state=FL&city=Jacksonville
These could be used in your script for logic.
You can take it a step further and add parameters to the get request and then parse them out of QUERY_STRING. Something like: http://192.168.1.1/cgi-bin/test.cgi?state=FL&city=Jacksonville
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<HTML><HEAD><TITLE>CGI Environment</TITLE></HEAD>"
echo "<BODY>"
echo "<pre>"
env
echo "</pre>"
echo "</BODY></HTML>"
Discuss on the OpenWrt forums: Uhttpd environment/CGI variables