我想使用服务Clickatell发送简单消息。C#clickatell发送短信HTTP GET请求
我不想读取响应,它将简单的GET请求发送消息。
该服务提供请求的样子:
https://platform.clickatell.com/messages/http/send?apiKey=xxxxxxxxxxxxxxxx==&to=xxxxxxxxxxx&content=Test+message+text
我,卷曲
curl "https://platform.clickatell.com/messages/http/send?apiKey=apiKEY==&to=NUMBER&content=Test+message+text"
检查了它,它的工作真的很好。
我尝试使用我的Windows使用它形成与HTTP请求 应用下面是我提供的代码:
var client2 = new HttpClient();
client2.GetAsync("https://platform.clickatell.com/messages/http/send?apiKey=apiKEY==&to=NUMBER&content=Test+message+text");
App.Write("SMS SEND!");
我有信息即发送短信,但我没有收到。我的朋友在.NET应用程序中使用我的代码,并为他工作。
我想念什么?
也许真的值得一提的是我需要使用System.Net.Http手动添加到引用;
编辑:
我试图添加到做异步,所以我编辑我的代码:
static void sendSMS()
{
var client2 = new HttpClient();
var task = client2.GetAsync("https://platform.clickatell.com/messages/http/send?apiKey=API_KEY==&to=MY_NUMBER&content=Test+message+text");
task.Wait();
App.Write("SMS SEND!");
}
但现在不显示在应用程序中发送短信消息。
更多细节,我知道你不想读取响应长远但是出于测试和获得它的工作也许你应该 – BugFinder