private void btnHSEX_Click(object sender, EventArgs e) { string url = ConfigurationManager.AppSettings["httpurl"] + "SendSMSEx.aspx"; string args = ""; args += "User="******"&Pass="******"&SubCode=" + txtSubCode.Text; args += "&Destinations=" + txtDestinations.Text; args += "&Content=" + txtContent.Text; args += "&WapPushUrl=" + txtWapPushUrl.Text; args += "&SendTime=" + txtSendTime.Text; string sr = (string)HTTPRequest.PostWebRequest(url, args, System.Text.Encoding.UTF8); if (sr == "") { MessageBox.Show("请求接口失败!"); return; } SendSMSResult result = JsonConvert.DeserializeObject <SendSMSResult>(sr); MessageBox.Show(result.Result); }
private void btnHS_Click(object sender, EventArgs e) { try { string url = ConfigurationManager.AppSettings["httpurl"] + "/SMS/SendSMS"; IDictionary <string, string> p = new Dictionary <string, string>(); p.Add("User", txtAccount.Text); p.Add("Pass", txtPassword.Text); p.Add("Mobiles", txtDestinations.Text); p.Add("Content", txtContent.Text); p.Add("SendTime", txtSendTime.Text); string sr = HTTPRequest.Post(url, p, System.Text.Encoding.UTF8); if (sr == "") { MessageBox.Show("请求接口失败!"); return; } SendSMSResult result = JsonConvert.DeserializeObject <SendSMSResult>(sr); MessageBox.Show(result.Result); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnWS_Click(object sender, EventArgs e) { string url = ConfigurationManager.AppSettings["wsurl"] + "SMWebService.asmx"; string[] args = new string[6]; args[0] = txtAccount.Text; args[1] = txtPassword.Text; args[2] = txtDestinations.Text; args[3] = txtContent.Text; args[4] = txtWapPushUrl.Text; args[5] = txtSendTime.Text; string sr = (string)WSHelper.InvokeWebService(url, "SendSMS", args); if (sr == "") { MessageBox.Show("请求接口失败!"); return; } SendSMSResult result = JsonConvert.DeserializeObject <SendSMSResult>(sr); MessageBox.Show(result.Result); }