网址是要吧的,你只要不发连接就行了。稍等一下吧,这个方法我稍后更新上去。
你如果急用的话可以先在这个方法的基础使用,应该是可以的,或者你自己再修改一下。
[C#] 纯文本查看 复制代码 /// <summary>
/// 获取返回的流
/// </summary>
/// <param name="newverifyUrl">验证URL</param>
/// <param name="cookieReg">Cookie</param>
/// <param name="regurl">URL</param>
/// <param name="proxy">代理IP</param>
/// <returns>StreamReader</returns>
public StreamReader GetStream(string newverifyUrl, CookieContainer cookieReg, string regurl, string proxy)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(regurl);
//设置代理服务器
WebProxy myProxy = new WebProxy(proxy, false);
//建议连接
myProxy.Credentials = new NetworkCredential("", "");
//给当前请求对象
request.Proxy = myProxy;
//设置安全凭证
request.Credentials = CredentialCache.DefaultNetworkCredentials;
request.Method = "get";
request.Accept = "text/html, application/xhtml+xml, */*";
request.ContentType = "application/x-www-form-urlencoded";
request.Referer = newverifyUrl;
//Cookie
request.CookieContainer = cookieReg;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
return new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("gb2312"));
} |