Send a POST to a Json server
#!/bin/bash
BOT_SERVICE=”http://bots.json.com”message=$(cat <<EOF
{
“to”:”test@test.com”,
“from”:”test@test.com”,
“html”:”<font color=’red’>Am a bot.</font>”
}
EOF
)
curl -i -X POST -H “Content-Type: application/json” -d “$message” $BOT_SERVICE
Can also read in a file and format that as the message
#!/bin/bash
bot_input=”bot_input.txt”
BOT_SERVICE=”http://bots.json.com”html_input=$(<$bot_input)
message=$(cat <<EOF
{
“to”:”test@test.com”,
“from”:”test@test.com”,
“html”:”$html_input”
}
EOF
)
curl -i -X POST -H “Content-Type: application/json” -d “$message” $BOT_SERVICE