Posted By

smsmatrix on 07/22/10


Tagged

c sms gateway


Versions (?)

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


 / Published in: C#
 

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

  1. string MATRIXURL = "http://www.smsmatrix.com/matrix";
  2. string PHONE = "12506063167";
  3. string USERNAME = Server.UrlEncode ("[email protected]");
  4. string PASSWORD = Server.UrlEncode ("pass72727");
  5. string TXT = Server.UrlEncode ("This is a test, pls ignore");
  6.  
  7. string q = "username=" + USERNAME +
  8. "&password=" + PASSWORD +
  9. "&phone=" + PHONE +
  10. "&txt=" + TXT;
  11.  
  12. HttpWebRequest req = (HttpWebRequest)WebRequest.Create (MATRIXURL);
  13. req.Method = "POST";
  14. req.ContentType = "application/x-www-form-urlencoded";
  15. req.ContentLength = q.Length;
  16.  
  17. StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
  18. streamOut.Write (q);
  19. streamOut.Close();
  20.  
  21. StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
  22. string res = streamIn.ReadToEnd();
  23. Console.WriteLine ("Matrix API Response:\n" + res);
  24. streamIn.Close();

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: smsmatrix on July 26, 2010

Also check canadian version of the sms gateway

You need to login to post a comment.