I’m trying to POST to the HTTP gateway of an SMS provider (Sybase 365) using CURL from a Linux shell script.
I need to pass the following data (note the [ ] and LF characters)
[MSISDN] List=+12345678 [MESSAGE] Text=Hello [END]
If I submit a file using the -F parameter, CURL removes the LF e.g.
curl -F @myfile "http://www.sybase.com/..."
results in this at the server (which is rejected)
Is there anything I can do to avoid this or do I need an alternative tool?
I’m using a file containing my data for testing but I’d like to avoid that in practice and POST directly from the script.
I’ve got this working using -d
request=`printf "[MSISDN]nList=$numbern[MESSAGE]nText=$messagen[END]n"` response=`curl -s -u $username:$password -d "$request" http://www.sybase.com/...`
Curiously, if I use -d @myfile (where myfile contains LF separated text), it doesn’t work.
I also tried –data-binary without success.