|
楼主 |
发表于 2013-5-4 13:21:14
|
显示全部楼层
- HttpHelper httpHelper = new HttpHelper();
- HttpItem item = new HttpItem();
- HttpResult result = new HttpResult();
- try
- {
- item.URL = urlModel.URL;
- item.ResultType = ResultType.Byte;
- if (urlModel.Method == "GET")
- {
- item.Allowautoredirect = false;
- item.Method = "GET";
- }
- else
- {
- item.Allowautoredirect = false;
- item.Method = "post";
- item.PostDataType = PostDataType.String;
- item.ContentType = "application/x-www-form-urlencoded";
- item.Postdata = urlModel.PostData;
- }
-
- result = httpHelper.GetHtml(item, false);
-
- html= result.Html;
- contentType= result.ContentType;
- }
- catch (Exception ex)
- {
- }
复制代码 我现在使用的获取源码方法就是飞哥的HttpHelper类。我的调用方式是这样的 |
|