public void postData(string urlOrigin, string urlPath, dynamic postData) { postData = "rl_key=8288051597031451712&vid=8288051597031451712&bs=haokan_detailpage&type=0"; // 发送post信息 CookieCollection cookie; string html = HttpTool.GetHtml(urlOrigin + urlPath, postData, Method.POST, out cookie); if (cookie.Count > 0) { Console.WriteLine("已完成Post请求!"); } //System.Diagnostics.Process.Start(url); //直接可以访问的网页打开方式 }
/// <summary> /// 发送登录信息,进行登录 /// </summary> public void Login_Click() { // 设置登录信息 string url = "https://baijiahao.baidu.com/builder/theme/bjh/login"; string postData = ""; // 发送post信息,进行登录 string html = HttpTool.GetHtml(url, postData, Method.POST, out cookie); if (cookie.Count > 0) { Console.WriteLine("您已成功登录!"); } }
/// <summary> /// 获取其他页面数据信息(登录成功后,或不需要登录) /// </summary> public void getURL(string url) { string data = HttpTool.GetHtml(url); // 实时获取网页数据 Console.WriteLine(data); }
/// <summary> /// 登录成功后,在浏览器中打开url /// </summary> public void openURl(string url) { HttpTool.openUrl(url); //System.Diagnostics.Process.Start(url); //直接可以访问的网页打开方式 }