public static void DotestForMyhttp() { MyWebTool.MyHttp myHttp = new MyWebTool.MyHttp(false, true); myHttp.SendData("http://pv.sohu.com/cityjson?ie=utf-8", null, "POST", null, @"D:\shou1.txt"); myHttp.SendData("http://pv.sohu.com/cityjson", "ie=utf-8", "GET"); myHttp.SendData("http://pv.sohu.com/cityjson", "ie=utf-8", "POST"); myHttp.SendData("http://pv.sohu.com/cityjson", "ie=utf-8", "POST", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("name", "DotestForMyhttp") }, null, null); List <MyWebTool.HttpMultipartDate> hml = new List <MyWebTool.HttpMultipartDate>(); hml.Add(new MyWebTool.HttpMultipartDate("multipart name", "file name", null, false, "test data")); hml.Add(new MyWebTool.HttpMultipartDate("multipart name", null, "comtenttype", false, "test data")); myHttp.HttpPostData("http://pv.sohu.com/cityjson?ie=utf-8", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("name", "DotestForMyhttp") }, "body data", hml, null, null); myHttp.HttpPostData("http://pv.sohu.com/cityjson?ie=utf-8", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("name", "DotestForMyhttp") }, "body data", hml, "a=1&b=2&c=4", null); hml.Add(new MyWebTool.HttpMultipartDate("multipart name", "file name", "comtenttype", true, @"D:\shou1.txt")); myHttp.HttpPostData("http://pv.sohu.com/cityjson?ie=utf-8", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("name", "DotestForMyhttp") }, "body data", hml, "a=1&b=2&c=4", null); }
public HttpClient(int yourTimeOut, bool yourIsShowResponseHeads, bool yourIsUseDefaultCookieContainer, Encoding yourRequestEncoding, Encoding yourResponseEncoding) { myHttp = new MyWebTool.MyHttp(true, yourIsUseDefaultCookieContainer); isShowRawResponse = yourIsShowResponseHeads; myHttp.HttpTimeOut = yourTimeOut; myHttp.RequestEncoding = yourRequestEncoding; myHttp.ResponseEncoding = yourResponseEncoding; }
public static void DotestForMyhttps() { MyWebTool.MyHttp.EnableServerCertificateValidation = true; MyWebTool.MyHttp myHttp = new MyWebTool.MyHttp(false, true); //https://iuc.oppomobile.com/account/user-info MyCommonHelper.NetHelper.MyWebTool.MyHttpResponse myHttpResponse = myHttp.SendHttpRequest(@"https://lijie.com/hello", null, "GET", null, false, null, null); Console.WriteLine(myHttpResponse.ResponseRaw ?? myHttpResponse.ErrorMes); myHttpResponse = myHttp.SendHttpRequest(@"https://iuc.oppomobile.com/account/user-info", null, "GET", null, false, null, null); Console.WriteLine(myHttpResponse.ResponseRaw ?? myHttpResponse.ErrorMes); //Console.WriteLine(myHttp.SendData(@"https://api.weixin.qq.com/sns/oauth2/access_token?code=061v6AGK1pOTj40nF0EK1LNwGK1v6AGV&grant_type=authorization_code&appid=wx01f2ab6d9e41169a&secret=1d2f3f1bdd6b2790b48ae64c8bc9bfdb")); }
static void Main(string[] args) { myHttp = new MyWebTool.MyHttp(); Console.ReadLine(); for (int i = 0; i < 500; i++) { Do(); } //Do2(); Console.ReadLine(); }
public static void DotestForMyhttp2() { MyWebTool.MyHttp myHttp = new MyWebTool.MyHttp(false, true); List <MyWebTool.HttpMultipartDate> hml = new List <MyWebTool.HttpMultipartDate>(); hml.Add(new MyWebTool.HttpMultipartDate("multipart name", "file name", null, false, "test data")); hml.Add(new MyWebTool.HttpMultipartDate("multipart name", null, "comtenttype", false, "test data")); Console.WriteLine(myHttp.SendMultipartRequest("http://pv.sohu.com/cityjson?ie=utf-8", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("name", "DotestForMyhttp") }, true, "body data", hml, null, null, null, null).ResponseBody); Console.WriteLine(myHttp.SendMultipartRequest("http://pv.sohu.com/cityjson?ie=utf-8", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("name", "DotestForMyhttp") }, true, "body data", hml, "a=1&b=2&c=4", null, null, null).ResponseRaw); hml.Add(new MyWebTool.HttpMultipartDate("multipart name", "file name", "comtenttype", true, @"D:\shou1.txt")); Console.WriteLine(myHttp.SendMultipartRequest("http://pv.sohu.com/cityjson?ie=utf-8", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("name", "DotestForMyhttp") }, true, "body data", hml, "a=1&b=2&c=4", null, null, null).ResponseBody); }
public UpgradeService() { MyWebTool.MyHttp.EnableServerCertificateValidation = true; myHttp = new MyWebTool.MyHttp(); }
public HttpClient() { myHttp = new MyWebTool.MyHttp(); }
public UpgradeService() { myHttp = new MyWebTool.MyHttp(); }