HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://tousu.baidu.com/submit",//URL 必需项
Method = "GET",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "",//字符串Cookie 可选项
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",//用户的浏览器类型,版本,操作系统 可选项有默认值
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Referer ="http://tousu.baidu.com/submit",//来源URL 可选项
Allowautoredirect = False,//是否根据301跳转 可选项
AutoRedirectCookie = False,//是否自动处理Cookie 可选项
//CerPath = "d:\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数
//Connectionlimit = 1024,//最大连接数 可选项 默认为1024
Postdata = "email=123456%40qq.com&title=%E5%BF%AB%E7%85%A7%E5%88%A0%E9%99%A4%E4%B8%8E%E6%9B%B4%E6%96%B0&content=%E5%BF%AB%E7%85%A7%E5%88%A0%E9%99%A4%E4%B8%8E%E6%9B%B4%E6%96%B0&links=http%3A%2F%2Fcache.baiducontent.com%2Fc%3Fm%3D9f65cb4a8c8507ed19fa950d100b813b481597634b888b443f89d215c7224c413037bee43a6a4a13d3b32d3b1cf9141ab6a7706f66427ae4db8a955e98e6d27e20d9303471%26p%3D9066cf0785cc43f308e2947e0c0c8c%26newp%3D897dce16d9c133ff57ed947f615283231610db2151d7d5156b82c825d7331b001c3bbfb42325130ed7c478620aac4357e9f5317535012ba3dda5c91d9fb4c57479fa%26user%3Dbaidu%26fm%3Dsc%26query%3DC%2523%26qid%3D97aafe9700030bc3%26p1%3D7&category_id=1&pid=1&submit_token=d1f71d761a0297c482ead5f11aae8fc2&ptfk=0",//Post数据 可选项GET时不需要写
//ProxyIp = "192.168.1.105:2020",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数
//ProxyPwd = "123456",//代理服务器密码 可选项
//ProxyUserName = "administrator",//代理服务器账户名 可选项
ResultType = ResultType.String,//返回数据类型,是Byte还是String
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
站长苏飞 发表于 2018-2-9 17:23
[mw_shl_code=csharp,true]HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |