1

How can I send a message to kannel with lines and special character. Example if I have file message.txt which have following text

line1 with few special characters like @ " / :
line 2 spaces words etc
line 3 "special characters like @ " / :
line 4 end

How can I pass this to KANNEL via bash using CURL ? like curl root@radius:/temp# cat test

#!/bin/bash
MSG=`cat /temp/message.txt`
curl "http://127.0.0.1:13013/cgi-bin/sendsms?username=kannel&password=kannelpassword&to=03333333333&text=$MSG"

But it says "curl: (3) Illegal characters found in URL"

I could have used GAMMU but it is not detecting my (teltonika g/10 com serial modem, while on kannel the modem is working fine.

Are there any other suggestions on how to send SMS via using serial modem with the text shown above?

1 Answer 1

1

Try --data-urlencode with -G.

curl "http://127.0.0.1:13013/cgi-bin/sendsms?username=kannel&password=kannelpassword&to=03333333333" -G --data-urlencode text@/temp/message.txt

You can feed the data from stdin:

ls -l | curl "http://127.0.0.1:13013/..." -G --data-urlencode text@-

Or specify it directly on the command line:

curl "http://127.0.0.1:13013/..." -G --data-urlencode text='!@#$%^&*()'
2
  • one more thing . What if I want to send such messages (with spaces and special characters) via URL directly? means the message i want to send is not in text file, i wan to submit it directly via curl ? Commented Jul 30, 2015 at 8:09
  • 1
    @SyedJahanzaib Answer updated. Commented Jul 30, 2015 at 8:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.