我想使用服務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