.NET Examples

  • Why not share:
  • Social sharing button for Facebook
  • Social sharing button for Linkedin
  • Social sharing button for Twitter
  • Social sharing button for Googleplus
  • Social sharing button for Pinterest

Example of a .NET Bulk SMS Gateway / API integration

For more information regarding the bulk sending API click here.

A simple example for sending SMS via a .NET method

Here’s a stand-alone .Net method:

privatestaticstring SendSms(string p_userName, string p_password, string p_orig, string p_number, string p_message, bool p_respondInXml) {

StringBuilder requestUrl = newStringBuilder();
requestUrl.Append(http://api.textmarketer.co.uk/gateway/);
requestUrl.Append(“?username=”).Append(HttpUtility.UrlEncode(p_userName));
requestUrl.Append(“&password=”).Append(HttpUtility.UrlEncode(p_password));
requestUrl.Append(“&orig=”).Append(HttpUtility.UrlEncode(p_orig));
requestUrl.Append(“&number=”).Append(p_number);
requestUrl.Append(“&message=”).Append(HttpUtility.UrlEncode(p_message));
if (p_respondInXml) {
requestUrl.Append(“&option=”).Append(“xml”);
}
WebRequest webRequest = HttpWebRequest.Create(requestUrl.ToString());
WebResponse webResponse = webRequest.GetResponse();
Stream responseStream = webResponse.GetResponseStream();
StreamReader streamReader = newStreamReader(responseStream);
return streamReader.ReadToEnd();
}
And here’s an example of calling it:

string response = SendSms(“MyUsername”, “MyPassword”, “MyNumber”, “4477777777″, “This is a test”, true);


No related posts.