How to POST 'shell output' as JSON data with Curl

1,927

Using one type of quote is more simple and solves that issue;

curl -H "Content-Type: application/json" -X POST -d "{\"uptime\": \"$(uptime)\"}" "http://sitename.com/update.php"

or you can use 2 quote types but it's less elegant;

curl -H 'Content-Type: application/json' -X POST -d '{"uptime": "'"$(uptime)"'"}' 'http://sitename.com/update.php'
Share:
1,927

Related videos on Youtube

DanielD
Author by

DanielD

Updated on September 18, 2022

Comments

  • DanielD
    DanielD over 1 year

    I've been able to configure my tomcat server in Intellij and have been able to run the server successfully. However, I can't seem to find where to actually add my project to the server in intellij. I'm used to using eclipse where I would right-click my server and use the "Add and Remove" feature for the server. Is there something similar in intellij?

    • DanielD
      DanielD over 8 years
      I've tried to add my project in the server config setting under the deployment tab but now when I run the server, I'm getting a 404
  • Mc Kernel
    Mc Kernel over 7 years
    nop, it doesn't uptime doesn't gives me any output like this, thats what I got at first and I already fixed it closing the opened single-quote at the start, concatenating with my command, and opening it again to close the brakes