0

我已经注册了 clickatell 服务来发送短信。他们给了我下面的 vb.net 代码,并说他们不知道这是对还是错。

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

我尝试了代码,它没有给出任何错误,但也没有收到短信。请帮忙。

4

1 回答 1

0

您的目的地手机号码也不应该有前导零。

如果您使用前导零,则 API 将返回此错误:ERR: 105, Invalid Destination Address

您确实需要记录 API 响应,否则您不知道网关是否接受了您的消息。

于 2014-02-13T10:54:21.300 回答