// SMSified API endpoint.
string webTarget = "https://api.smsified.com/v1/smsmessaging/outbound/{0}/requests";
// Parameters to send with API request.
string webPost = "address={0}&message={1}";
// SMSified credentials.
string userName = "";
string password = "";
string senderNumber = "";
// Create new HTTP request.
string url = String.Format(webTarget, senderNumber);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] postData = Encoding.ASCII.GetBytes(String.Format(webPost, "14075551212", "This is a test from C#"));
req.ContentLength = postData.Length;
// Set HTTP authorization header.
string authInfo = userName + ":" + password;
authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
req.Headers["Authorization"] = "Basic " + authInfo;
// Send HTTP request.
Stream PostStream = req.GetRequestStream();
PostStream.Write(postData, 0, postData.Length);
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
Next
« Prev Post
« Prev Post
Previous
Next Post »
Next Post »
Subscribe to:
Post Comments (Atom)
Most Viewed Posts
- Angular 11 CRUD Application using Web API
- Bind Dropdownlist in ASP.NET MVC
- Fixed - The 'Microsoft.ACE.OLEDB.12.0' Provider Is Not Registered On The Local Machine
- Ho to Merge Multiple PDF Files Into Single PDF in C#
- How to Convert DataTable to CSV
- How to Convert GridView to DataTable in C#
- How to Convert JSON to DataTable/Dataset
- How to Export Dataset/Datatable to CSV
- How to Get Distinct Records From DataTable
- JQuery Multiselect Dropdown List With Checkbox
ConversionConversion EmoticonEmoticon