一个C#后台调用接口的例子
string url = ConfigurationSettings.AppSettings["resurl"].ToString(); var wc = new WebClient(); var p = "{'accountname':'tykj20180101','accountpwd':'tykj20180101','boxnumber':'" + Chest_Site.ToString() + "'}"; var buffer = System.Text.Encoding.UTF8.GetBytes(p); string str; try { str = System.Text.Encoding.UTF8.GetString(wc.UploadData(url, "POST", buffer)); } catch { string script = "alert('打开失败! ');"; return JavaScript(script); }
posted on 2018-01-05 14:08 YellowCool 阅读(716) 评论(0) 编辑 收藏 举报