Skip to content

Instantly share code, notes, and snippets.

@zircote
Created January 31, 2011 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zircote/804353 to your computer and use it in GitHub Desktop.
Save zircote/804353 to your computer and use it in GitHub Desktop.
string cUrl = "https://{CVAccountName}.cloudvox.com/api/v1/applications/{CVAppID}/sms";
HttpWebRequest webClient = (HttpWebRequest) WebRequest.Create(cUrl);
// *** Send any POST data
string postData = "to={to}&from={CVPhoneNumber}&message={message}";
webClient.Method="POST";
byte [] postBuffer = System.Text.Encoding.GetEncoding(1252).GetBytes(postData);
webClient.ContentLength = postBuffer.Length;
webClient.Credentials = new System.Net.NetworkCredential(myusername, mypassword);
Stream loPostData = webClient.GetRequestStream();
loPostData.Write(postBuffer,0,postBuffer.Length);
loPostData.Close();
HttpWebResponse webResponse = (HttpWebResponse) webClient.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader responseStream = new StreamReader(webResponse.GetResponseStream(),enc);
string html = responseStream.ReadToEnd();
webResponse.Close();
responseStream.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment