How to write bash Shell CGI under uhttpd

Source: Internet
Author: User

How to write bash Shell CGI under uhttpdcgi

    • Target
    • Reference
    • WWW ROOT Dir on OpenWRT
    • Browser Client Access

Target

Want to provide the Smaple RESTful server under UHTTPD on OpenWRT, I-Select the bash script for a demo

Reference

Bash CGI
Web CGI with Bash Script
PostMan Tester

WWW ROOT Dir on OpenWRT

/www/cgi/test.cgi

  1. #!/bin/sh
  2. post_string=$ (CAT)
  3. Echo "Content-type:application/json"
  4. Echo ""
  5. Echo "$POST _string"

UHTTPD passes ' GET ' paramter to bash by ' $QUERY _string '
UHTTPD passes ' POST ' conent to bash by STDIN, so bash with ' post_string=$ (cat) ' to get them

Browser Client Access

http://192.168.254.219/cgi-bin/test.cgi

[email protected] 2017-4-21

How to write bash Shell CGI under uhttpd

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.