[C#] 纯文本查看 复制代码 HttpHelper http = new HttpHelper();
HttpItem item = null;
string cookie = "";
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("https://www.tenpay.com/");
label1.Text = "请登陆!";
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
label1.Text = "已经加载!";
cookie = Common.GetCookieString(e.Url.ToString());//获取完整cookie
richTextBox2.Text = cookie; //显示的就是 获取完整cookie
}
private void button1_Click(object sender, EventArgs e)
{
//把webBrowser1登陆的cookie传给HttpHelper
item = new HttpItem()
{
URL = webBrowser1.Url.AbsoluteUri,//URL
Method = "Get",//URL 可选项 默认为Get
Cookie = cookie,//调用webBrowser1登陆的cookie
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
richTextBox1.AppendText(html); }
}
获取百度没问题,财付通就出现“指定的值含有无效的控制字符。参数名: value”,而我用飞哥的助手,则获取页面没问题。百度了下也没找到解决方法,请教这是哪有问题呢,谢谢了!
|