Urlencode with cURL in bash with newlines

Viewed 5511

I am trying to send a request to our SMS gateway, where I want to put in some newlines in the SMS being sent.

So far, I got to this:

/usr/local/bin/curl -G --data-urlencode "text=*****centreon Notification *****\n\nType:$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\nDate/Time: $DATE$" "http://192.168.11.248:13013/cgi-bin/sendsms?username=user&password=password&from=12345678&to=87654321"

However, that doesn't work, as I get all the \n's in my SMS, where there should be a new line.

I have a PHP script where the \n works, but as I cannot call a PHP script, I have to do this with a oneliner, where cURL comes into play.

3 Answers
Related