应该再加上个编码,要不可能不管用
[C#] 纯文本查看 复制代码 string url = "https://s.1688.com/selloffer/offer_search.htm?keywords={0}&beginPage={1}";
string kw = "手机";
string pagesize = "2";
url = string.Format(url, HttpHelper.URLEncode(kw,Encoding.GetEncoding("gbk")), pagesize);
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = url,//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 = "textml, application/xhtml+xml, */*",// 可选项有默认值
ContentType = "textml",//返回类型 可选项有默认值
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
Response.Write(html);
|