|
新手不懂就用GET来抓页面,但是没办法呢抓取天猫的宝贝页面,提示302 浏览器可以使用
string qt = "http://detail.tmall.com/item.htm?spm=a230r.1.14.18.6ockEh&id=45197802445";
//创建Httphelper对象
HttpHelper http = new HttpHelper();
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL = qt,//URL 必需项
Method = "get",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
//ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
};
//请求的返回值对象
HttpResult result = http.GetHtml(item);
//获取请请求的Html
string html = result.Html;
错误信息:<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<h1>302 Found</h1>
<p>The requested resource resides temporarily under a different URI.</p>
<hr/>Powered by Tengine</body>
</html>
|
|