Es una pregunta muy básica. Hay un servidor API que acepta archivos json para crear tickets.
Quiero crear un botón en HTML (Apache), de modo que cuando haga clic, ejecute un comando CURL para enviar una solicitud al servidor API para que se cree un ticket de resultado.
He creado un archivo BASH - ejecutable (a+x) ¡Tengo Apache ejecutándose y el botón incluso funciona! ¡pero aparentemente el comando CURL no está enviando la solicitud correctamente! No hay ningún error en absoluto. No tengo idea de cómo solucionar este problema:
Código HTML:
<form action="../cgi-bin/cgi.sh" method="post"> <input type="submit" value="Call my Shell Script"> </form>Archivo BASH: #!/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>