Developer Tools
BasicText SMSCampaignSendOTPVirtual NumberResellerSample CodePhonebookError Code
HOME LOGIN SIGN UP
  • Send SMS in PHP
  • Send SMS in Python
  • Send SMS in JAVA
  • Send SMS in JAVA For XML API
  • Send SMS in C#
  • Send SMS in Google Appscript
  • Send SMS in Windows 8
  • Send SMS in Android
  • Send SMS in iOS
  • Send SMS in VB6
  • Send SMS in Oracle
  • Send SMS in Go Language
  • Api Postman Collection

HTTP Send SMS API Using Windows Phone 8 - C#

Code:

try
{
string strResult = ""; //Prepare you post parameters
var postValues = new List<KeyValuePair<string, string>>(); //Your authentication key
postValues.Add(new KeyValuePair<string, string>("authkey", "YourAuthKey")); //Multiple mobiles numbers separated by comma
postValues.Add(new KeyValuePair<string, string>("mobiles", "9999999")); //Sender ID,While using route4 sender id should be 6 characters long.
postValues.Add(new KeyValuePair<string, string>("sender", "102234")); //Your message to send, Add URL encoding here.
string message = HttpUtility.UrlEncode("Test message");
postValues.Add(new KeyValuePair<string, string>("message", message)); //Select route
postValues.Add(new KeyValuePair<string, string>("route","default"));
//Prepare API to send SMS
Uri requesturl = new Uri("http://api.msg91.com/api/sendhttp.php"); //create httpclient request
var httpClient = new HttpClient();
var httpContent = new HttpRequestMessage(HttpMethod.Post, requesturl); httpContent.Headers.ExpectContinue = false; httpContent.Content = new FormUrlEncodedContent(postValues); HttpResponseMessage response = await httpClient.SendAsync(httpContent);
//Get response
var result = await response.Content.ReadAsStringAsync(); strResult = result.ToString(); response.Dispose();
httpClient.Dispose();
httpContent.Dispose();
}
catch (Exception ex)
{
throw ex;
}

© 2008-2025 | All Rights Reserved.