Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

serverurlencode

Send SMS using www.smsmatrix.com gateway in C#
Thursday, 22 July 2010 04:29
Send sms (worldwide) using www.smsmatrix.com.
More examples at SMS Gateway page.


string MATRIXURL = "http://www.smsmatrix.com/matrix";
string PHONE = "12506063167";
string USERNAME = Server.UrlEncode (" This e-mail address is being protected from spambots. You need JavaScript enabled to view it ");
string PASSWORD = Server.UrlEncode ("pass72727");
string TXT = Server.UrlEncode ("This is a test, pls ignore");

string q = "username=" + USERNAME +
"&password=" + PASSWORD +
"&phone=" + PHONE +
"&txt=" + TXT;

HttpWebRequest req = (HttpWebRequest)WebRequest.Create (MATRIXURL);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = q.Length;

StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
streamOut.Write (q);
streamOut.Close();

StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
string res = streamIn.ReadToEnd();
Console.WriteLine ("Matrix API Response:\n" + res);
streamIn.Close();

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/D0t_E6JFAnw/11919

 


Taxonomy by Zaragoza Online