It's a very basic question. There is an API server which accepts json file to create tickets.
I want to create a button on HTML (Apache) - so when click, runs a CURL command to submit a request to API server so as result ticket will be created.
I have created a BASH file - executable (a+x) I have Apache running and button is even working! but apparently the CURL command is not sending the request properly! There is no error at all. I have no idea how to troubleshoot this:
HTML code:
<form action="../cgi-bin/cgi.sh" method="post">
<input type="submit" value="Call my Shell Script">
</form>
BASH file: #!/bin/sh
OUTPUT="$curl -sS --negotiate --location-trusted -u: -c ~/.cookie -b ~/cookie https://API-Server.com/ticket -H 'Content-Type: application/json' --data-binary '{"descriptionContentType":"text/markdown","extensions":{"tt":{"Reason":[],"category":"Ticket","type":"New","item":"UserPC"}},"description":"Test","title":"TitleTest"}'"
# outputting data to the web browser from shell
# script
echo "Content-type: text/html"
echo ""
echo "<html><head><title>Demo</title></head><body>"
echo "Done. $OUTPUT <br>"
echo "</body></html>"
http.conf
LoadModule cgid_module modules/mod_cgid.so
ScriptAlias "/cgi-bin/" "/var/www/cgi-bin/"
<Directory "/var/www/cgi-bin">
AllowOverride None
# Options None
Options +ExecCGI
Require all granted
</Directory>