예제 #1
0
        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);
        }
예제 #2
0
 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;
 }
예제 #3
0
 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"));
 }
예제 #4
0
 static void Main(string[] args)
 {
     myHttp = new MyWebTool.MyHttp();
     Console.ReadLine();
     for (int i = 0; i < 500; i++)
     {
         Do();
     }
     //Do2();
     Console.ReadLine();
 }
예제 #5
0
        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);
        }
예제 #6
0
 public UpgradeService()
 {
     MyWebTool.MyHttp.EnableServerCertificateValidation = true;
     myHttp = new MyWebTool.MyHttp();
 }
예제 #7
0
 public HttpClient()
 {
     myHttp = new MyWebTool.MyHttp();
 }
예제 #8
0
 public UpgradeService()
 {
     myHttp = new MyWebTool.MyHttp();
 }