if I run this command in linux shell.
curl=`curl --connect-timeout 4 -k -X POST -H "Content-type: text/xml" --data "<MyRequest><HeartBeat timestamp=\"1311157780201\"></HeartBeat></MyRequest>" http://192.168.1.100:8484/rest/service?action=heartbeat 2>&1 | tee` echo "$curl"
I get following response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MyResponse><HeartBeat status="SUCCESS"></HeartBeat></MyResponse>
But when the same command is executed in a bash CGI script and output is displayed in html pre tags, I see some weird table and no XML data is displayed at all.
in CGI bash script i have this code
curl=`curl --connect-timeout 4 -k -X POST -H "Content-type: text/xml" --data "<MyRequest><HeartBeat timestamp=\"1311157780201\"></HeartBeat></MyRequest>" http://192.168.1.100:8484/rest/service?action=heartbeat 2>&1 | tee` echo "<h2> RAW Troubleshooting Data </h2><pre>" echo "$curl" echo "</pre>" exit 0
instead of XML data, following table is displayed in the web browser.
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 76 0 424 --:--:-- --:--:-- --:--:-- 424 202 126 0 126 0 76 302 182 --:--:-- --:--:-- --:--:-- 210
However, if I use the curl verbosity with -v command in cgi bash script I get following out in my web browser but still the XML response is missing.
* About to connect() to xx.xx.xx.xx port xxxxx (#0) * Trying xx.xx.xx.xx... connected * Connected to xx.xx.xx.xx (xx.xx.xx.xx) port xxxxx (#0) > POST /rest/service?action=heartbeat HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: xx.xx.xx.xx:xxxx > Accept: */* > Content-type: text/xml > Content-Length: 76 > } [data not shown] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 76 0 422 --:--:-- --:--:-- --:--:-- 422< HTTP/1.1 200 OK < Server: nginx < Date: Thu, 14 Nov 2019 18:53:44 GMT < Content-Type: application/xml < Transfer-Encoding: chunked < Connection: keep-alive < Vary: Accept-Encoding < X-Powered-By: PHP/7.0.32 < { [data not shown] 202 126 0 126 0 76 284 171 --:--:-- --:--:-- --:--:-- 190 202 126 0 126 0 76 284 171 --:--:-- --:--:-- --:--:-- 190* Connection #0 to host xx.xxx.xxx.xx left intact * Closing connection #0
Your help is appreciated.