HttpHelper.cs
(开头部分) 21KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.IO.Compression;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
namespace DotNet.Utilities
{
/// <summary>
/// Http连接操作帮助类
/// <example>
/// 下面是个例子大家可以看一下
///
/// HttpHelper http = new HttpHelper();
/// HttpItem item = new HttpItem()
/// {
/// URL = "http://www.cckan.net",//URL 必需项
/// Encoding = "gbk",//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
/// Method = "get",//URL 可选项 默认为Get
/// //Timeout = 100000,//连接超时时间 可选项默认为100000
/// //ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
/// //IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
/// Cookie = "",//字符串Cookie 可选项
/// // UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
/// // Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
/// // ContentType = "text/html",//返回类型 可选项有默认值
/// Referer = "http://www.cckan.net",//来源URL 可选项
/// //Allowautoredirect = true,//是否根据301跳转 可选项
/// //CerPath = "d:\\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数
/// //Connectionlimit = 1024,//最大连接数 可选项 默认为1024
/// //Postdata = "username=sufei&pwd=cckan.net",//Post数据 可选项GET时不需要写
/// //ProxyIp = "192.168.1.105",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数
/// //ProxyPwd = "123456",//代理服务器密码 可选项
/// // ProxyUserName = "administrator",//代理服务器账户名 可选项
/// };
/// //得到HTML代码
/// string html = http.GetHtml(item);
///
/// //取出返回的Cookie
/// string cookie = item.Cookie;
/// //取出返回的Request
/// HttpWebRequest request = item.Request;
/// //取出返回的Response
/// HttpWebResponse response = item.Response;
/// //取出返回的Reader
/// StreamReader reader = item.Reader;
/// //取出返回的Headers
/// WebHeaderCollection header = response.Headers;
/// </example>
/// </summary>
public class HttpHelper
{
#region 预定义方法或者变更
//默认的编码
后面还有 526 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。