public static byte[] HttpPostTestProxy(string url, ProxyIpCacheResp proxy) { //Console.WriteLine(shortUrl + Url_GCI); HttpHelper http = new HttpHelper(); HttpItem item = new HttpItem() { URL = url, Method = "get", PostDataType = PostDataType.Byte, UserAgent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50", Accept = "*/*", //se = "SEC_SF_edcd630591726845634a339fa1e14168; Domain =.weixin110.qq.com; Path =/; Secure; HttpOnly", ResultType = ResultType.Byte, ProxyIp = proxy?.ProxyIp, // ProxyIp= "115.216.56.244:32329", ProxyUserName = proxy?.Username, ProxyPwd = proxy?.Password, KeepAlive = true, Timeout = 30000 }; HttpResult ret = http.GetHtml(item); // Console.WriteLine(ret.ResultByte.ToString(16, 2)); return(ret.ResultByte == null ? new byte[2] { 1, 2 } : ret.ResultByte); }
public static byte[] HttpPost(byte[] data, string Url_GCI, ProxyIpCacheResp proxy) { //Console.WriteLine(shortUrl + Url_GCI); HttpHelper http = new HttpHelper(); HttpItem item = new HttpItem() { URL = shortUrl + Url_GCI, Method = "post", PostdataByte = data, PostDataType = PostDataType.Byte, UserAgent = "MicroMessenger Client", Accept = "*/*", ContentType = "application/octet-stream", //se = "SEC_SF_edcd630591726845634a339fa1e14168; Domain =.weixin110.qq.com; Path =/; Secure; HttpOnly", ResultType = ResultType.Byte, ProxyIp = proxy?.ProxyIp, ProxyUserName = proxy?.Username, ProxyPwd = proxy?.Password }; HttpResult ret = http.GetHtml(item); // Console.WriteLine(ret.ResultByte.ToString(16, 2)); return(ret.ResultByte == null ? new byte[2] { 1, 2 } : ret.ResultByte); }
public static byte[] HttpPost(string url, byte[] data, string Url_GCI, ProxyIpCacheResp proxy) { //if (!IpHelper.IsProxy) //{ // proxy = null; //} if (string.IsNullOrEmpty(url)) { url = shortUrl; } //Console.WriteLine(shortUrl + Url_GCI); HttpHelper http = new HttpHelper(); HttpItem item = new HttpItem() { URL = url + Url_GCI, Method = "post", PostdataByte = data, PostDataType = PostDataType.Byte, UserAgent = "MicroMessenger Client", Accept = "*/*", ContentType = "application/octet-stream", //se = "SEC_SF_edcd630591726845634a339fa1e14168; Domain =.weixin110.qq.com; Path =/; Secure; HttpOnly", ResultType = ResultType.Byte, ProxyIp = proxy?.ProxyIp, ProxyUserName = proxy?.Username, ProxyPwd = proxy?.Password, KeepAlive = true }; //if (proxy!=null && !string.IsNullOrWhiteSpace(proxy.ClientProxyId)) //{ // ICommand.HttpItem commItem = new ICommand.HttpItem() // { // URL = item.URL, // Method = item.Method, // PostdataByte = item.PostdataByte, // PostDataType = ICommand.PostDataType.Byte, // UserAgent = item.UserAgent, // Accept = item.Accept, // ContentType = item.ContentType, // ResultType = ICommand.ResultType.Byte, // ProxyIp = item.ProxyIp, // ProxyUserName = item.ProxyUserName, // ProxyPwd = item.ProxyPwd, // KeepAlive = item.KeepAlive, // }; // ClientProxy.Proxy clientProxy = new ClientProxy.Proxy(); // byte[] byteResult = clientProxy.ClientHttpPost(proxy.ClientProxyId, commItem); // return byteResult; //} HttpResult ret = http.GetHtml(item); // Console.WriteLine(ret.ResultByte.ToString(16, 2)); return(ret.ResultByte == null ? new byte[2] { 1, 2 } : ret.ResultByte); }