public static void TestNginx() { string url = "http://localhost:88/Nginxstatus"; XMLHTTP http = new MSXML2.XMLHTTP(); try { http.open("GET", url, false, null, null); http.send(url); int status = http.status; if (status == 200) { Console.WriteLine("成功"); Console.WriteLine(System.Text.Encoding.Default.GetString(http.responseBody)); Console.ReadKey(); } else { Console.WriteLine("不可用status:" + status.ToString()); Console.ReadKey(); } } catch { Console.WriteLine("不可用"); Console.ReadKey(); } }
/// <summary> /// 获取余额接口 /// </summary> /// <param name="uid"></param> /// <param name="pwd"></param> /// <returns></returns> private string GetBalance(string uid, string pwd) { string Send_URL = "http://service.winic.org/webservice/public/remoney.asp?uid=" + uid + "&pwd=" + pwd + ""; MSXML2.XMLHTTP xmlhttp = new MSXML2.XMLHTTP(); xmlhttp.open("GET", Send_URL, false, null, null); xmlhttp.send(""); MSXML2.XMLDocument dom = new XMLDocument(); Byte[] b = (Byte[])xmlhttp.responseBody; string andy = System.Text.Encoding.GetEncoding("GB2312").GetString(b).Trim(); return(andy); }
private string SendMsg(string uid, string pwd, string mob, string msg) { switch (SiteConfig.SiteOption.DefaultSMS) { case "3": return(""); default: string Send_URL = "http://service.winic.org/sys_port/gateway/?id=" + uid + "&pwd=" + pwd + "&to=" + mob + "&content=" + msg + "&time="; MSXML2.XMLHTTP xmlhttp = new MSXML2.XMLHTTP(); xmlhttp.open("GET", Send_URL, false, null, null); xmlhttp.send(""); MSXML2.XMLDocument dom = new XMLDocument(); Byte[] b = (Byte[])xmlhttp.responseBody; //string Flag = System.Text.ASCIIEncoding.UTF8.GetString(b, 0, b.Length); string andy = System.Text.Encoding.GetEncoding("GB2312").GetString(b).Trim(); return(andy); } }
public string DataDetail(string numbersent, string bodysent, string lang, string AGRCODE) { string strResult = null; string str = null; if (lang == "TH") { str = "TRANSID=BULK&CMD=SENDMSG&FROM=66899264547&TO=" + numbersent + "&REPORT=N&CHARGE=N&CODE=KTBLeasing_BulkSMS&CTYPE=LUNICODE&CONTENT=" + String2Unicode(bodysent).ToUpper() + ""; } else { str = "TRANSID=BULK&CMD=SENDMSG&FROM=66899264547&TO=" + numbersent + "&REPORT=N&CHARGE=N&CODE=KTBLeasing_BulkSMS&CTYPE=LTEXT&CONTENT=" + bodysent + ""; } string url = null; //Link UAT //url = "http://203.170.230.170:3372/" //Link Production url = "http://http://corpsmsweb.dtac.co.th/servlet/com.iess.socket.SmsCorplink"; //ConfigurationManager.AppSettings["AISURL"]; MSXML2.XMLHTTP xmlRequest = new MSXML2.XMLHTTP(); xmlRequest.open("post", url); xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlRequest.setRequestHeader("charset", "utf-8"); xmlRequest.setRequestHeader("Content-Length", Convert.ToString(str.Length)); try { xmlRequest.setRequestHeader("Connection", "close"); xmlRequest.send(str); strResult = "Send SMS Complete "; } catch (Exception ex) { strResult = "Error:" + ex.Message.ToString(); } return(strResult); }
public static void TestWCF() { string url = "http://202.100.190.46:6080/MapService.svc"; XMLHTTP http = new MSXML2.XMLHTTP(); try { http.open("GET", url, false, null, null); http.send(url); int status = http.status; if (status == 200) { Console.WriteLine("成功"); Console.ReadKey(); } else { Console.WriteLine("不可用status:" + status.ToString()); Console.ReadKey(); } } catch { Console.WriteLine("不可用"); Console.ReadKey(); } }