Return to Snippet

Revision: 29130
at July 22, 2010 15:26 by smsmatrix


Initial Code
string MATRIXURL = "http://www.smsmatrix.com/matrix";
string PHONE = "12506063167";
string USERNAME = Server.UrlEncode ("[email protected]");
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();

Initial URL
http://www.smsmatrix.com/?sms-gateway

Initial Description

                                

Initial Title
Send SMS via www.smsmatrix.com SMS Gateway using C#

Initial Tags
c

Initial Language
C#