Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace SendSmsMessage
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnSend_Click(object sender, EventArgs e)
- {
- using (System.Net.WebClient client = new System.Net.WebClient()
- {
- try
- {
- string url = "http://smsc.vianett.no/v3/send.ashx?" +
- "src=" + txtPhoneNumber.Text + "&" +
- "dst=" + txtPhoneNumber.Text + "&" +
- "msg="System.Web.HttpUtility.UrlEncode(txtMessage.Text, System.Text.Encoding.GetEncoding("ISO-8859-1")) + "" +
- "username=" + System.Web.HttpUtility.UrlEncode(txtUsername.Text + "&" +
- "password=" + System.Web.HttpUtility.UrlEncode(txtPassword.Text);
- string result = client.DownloadString(url);
- if (result.Contains("OK"))
- MessageBox.Show("Tvoje zprava byla uspesne odeslana.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else
- MessageBox.Show("Chyba: Zpravu nebylo mozne odeslat", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement