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


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  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();

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.