Skip to content

Instantly share code, notes, and snippets.

@zircote

zircote/gist:804353

Created Jan 31, 2011
Embed
What would you like to do?
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
You can’t perform that action at this time.