Compare the Market: Nobody’s lower priced for quality SMS Lowest Bulk SMS Prices Free Bulk SMS Software
text marketer reviews Text Marketer RSS feeds

.NET Examples

Posted on July 27th, 2009 by Nick.


Categories: All SMS Gateway Documentation, Documentation, Technical

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:

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

StringBuilder requestUrl = new StringBuilder();
requestUrl.Append(http://www.textmarketer.biz/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 = new StreamReader(responseStream);
return streamReader.ReadToEnd();
}
And here’s an example of calling it:

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


Popularity: 9%






Related posts:

  1. PHP 5 Simple SMS send Class
    This blog post has been superseded with our website documentation 2 classes available in php 5, SendSMS and SendSMSXML (recommended) Class Name: SendSMS...
  2. Using the SMS Gateway API, Automating Delivery Report Collection
    This blog post has been superseded with our website documentation Introduction If you are using the API / Gateway to send bulk SMS...
  3. Text Marketer short code / txtUs API options
    Introduction The keyword on your system (on short code 88802) or your txtUs number can be used to “route” incoming...
  4. Bulk SMS API ASP Help
    Using standard ASP libraries <% url=”http://www.textmarketer.biz/gateway/?username=#&password=#&number=#&message=msg&orig=nameORnumber&option=xml” Set objXMLDoc = CreateObject(“Microsoft.XMLDOM”) objXMLDoc.async = False objXMLDoc.load(url) status = objXMLDoc.documentElement.selectSingleNode(“//response”).getAttribute(“status”) if status =...
  5. SMS Gateway API – Specification
    This blog post has been superseded with our website documentation It is recommended that you use the  RESTful version of the API which has largely superseded this document...
  6. The SMS Gateway
    How to use an SMS Gateway Continue reading →...

Comments are closed.