sms using clickatell, code not working

1.2k Views Asked by At

I have signed up for clickatell service to send sms. They have given me the following code for vb.net and said they do not know if this is right or wrong.

Dim client As WebClient = New WebClient
' Add a user agent header in case the requested URI contains a query.
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
client.QueryString.Add("user", "myusername")
client.QueryString.Add("password", "mypwd")
client.QueryString.Add("api_id", "myid")
client.QueryString.Add("to", "009232XXXXXXX")
client.QueryString.Add("text", "This is an example message using my vb.net code")
Dim baseurl As String = "http://api.clickatell.com/http/sendmsg"
Dim data As Stream = client.OpenRead(baseurl)
Dim reader As StreamReader = New StreamReader(data)
Dim s As String = reader.ReadToEnd()
data.Close()
reader.Close()
Return

I tried the code, it did not give any error but sms was not received too. Please help.

1

There are 1 best solutions below

0
On

Your destination mobile number also should not have the leading zero's.

If you use the leading zero's, then the API will return this error: ERR: 105, Invalid Destination Address

You really need to log the API responses, otherwise you do not know if the gateway accepted your message.