using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
using CsharpHttpHelper.Enum;
namespace CsharpHttpHelper.Item
{
/// <summary>
/// A连接对象 Copyright:http://www.httphelper.com/
/// </summary>
public class AItem
{
/// <summary>
/// 链接地址
/// </summary>
public string Href { get; set; }
/// <summary>
/// 链接文本
/// </summary>
public string Text { get; set; }
/// <summary>
/// 链接的图片,如果是文本链接则为空
/// </summary>
public ImgItem Img { get; set; }
/// <summary>
/// 整个连接Html
/// </summary>
public string Html { get; set; }
/// <summary>
/// A链接的类型
/// </summary>
public AType Type { get; set; }
}
}
using CsharpHttpHelper;
using CsharpHttpHelper.Item;
//创建Httphelper对象
HttpHelper http = new HttpHelper();
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL = "http://www.sufeinet.com",//URL 必需项
Method = "get",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
//ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
};
//请求的返回值对象
HttpResult result = http.GetHtml(item);
//获取请请求的Html
string html = result.Html;
List<AItem> alist = HttpHelper.GetAList(html);