Get started in minutes - simple, quick and free. Upon registering you will receive 5 free test credits to send SMS's with.
using System;
using System.Web;
using System.Net;
using System.IO;
using System.Text;
namespace SMS{
public class SendSMS{
static void Main( ){
UriBuilder urlBuilder = new UriBuilder();
urlBuilder.Scheme = "http";
urlBuilder.Host = "usa.bulksms.com";
urlBuilder.Port = 5567;
urlBuilder.Path = "/eapi/submission/send_sms/2/2.0";
/*
* Construct Http Post body/data
*/
/*
* Note the suggested encoding for certain parameters, notably
* the username, password and especially the message. ISO-8859-1
* is essentially the character set that we use for message bodies,
* with a few exceptions for (e.g.) Greek characters. For a full list,
* see: http://usa.bulksms.com/docs/eapi/submission/character_encoding/
*/
string data = "";
data += "username=" + HttpUtility.UrlEncode("myusername", System.Text.Encoding.GetEncoding("ISO-8859-1"));
data += "&password=" + HttpUtility.UrlEncode("xxxxxx", System.Text.Encoding.GetEncoding("ISO-8859-1"));
data += "&message=" + HttpUtility.UrlEncode("This is a test", System.Text.Encoding.GetEncoding("ISO-8859-1"));
data += "&want_report=1";
data += "&msisdn=44123123123";
/*
* Make Http Post request to server
*/
urlBuilder.Query = string.Format(data); ;
HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(new Uri(urlBuilder.ToString(), false));
HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse());
StreamReader input = new StreamReader(httpResponse.GetResponseStream());
Console.WriteLine(input.ReadToEnd());
httpResponse.Close();
}
}
}