C# Class RedXuCSharpClass.HttpHelper

Http操作类.
Mostra file Open project: redxu/HttpHelper

Public Methods

Method Description
AddHeader ( String key, String ctx ) : void

添加自定义头

ClearHeader ( ) : void

清空自定义头

DebugCookies ( ) : void
HttpGet ( String url ) : String

发送GET请求

HttpGet ( String url, String refer ) : String

发送GET请求

HttpGetMine ( String url ) : Byte[]

获取MINE文件

HttpHelper ( ) : System
HttpPost ( String url, String data ) : String

发送POST请求

HttpPost ( String url, String data, String refer ) : String

发送POST请求

InitCookie ( ) : void
RandUserAgent ( ) : void
SetAccept ( String accept ) : void
SetContentType ( String type ) : void
SetCookiesString ( string c ) : void
SetEncoding ( Encoding en ) : void

设置当前编码

SetTimeOut ( int msec ) : void

设置超时时间

SetUserAgent ( String ua ) : void

设置UserAgent

UrlEncode ( string str ) : string

Private Methods

Method Description
CheckCertificate ( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors ) : bool

检测证书

ConvertCookieString ( string ck ) : CookieCollection

转换cookie字符串到CookieCollection

GetStringFromResponse ( HttpWebResponse response ) : String

获取HTTP返回的内容

Method Details

AddHeader() public method

添加自定义头
public AddHeader ( String key, String ctx ) : void
key String
ctx String
return void

ClearHeader() public method

清空自定义头
public ClearHeader ( ) : void
return void

DebugCookies() public method

public DebugCookies ( ) : void
return void

HttpGet() public method

发送GET请求
public HttpGet ( String url ) : String
url String
return String

HttpGet() public method

发送GET请求
public HttpGet ( String url, String refer ) : String
url String
refer String
return String

HttpGetMine() public method

获取MINE文件
public HttpGetMine ( String url ) : Byte[]
url String
return Byte[]

HttpHelper() public method

public HttpHelper ( ) : System
return System

HttpPost() public method

发送POST请求
public HttpPost ( String url, String data ) : String
url String
data String
return String

HttpPost() public method

发送POST请求
public HttpPost ( String url, String data, String refer ) : String
url String
data String
refer String
return String

InitCookie() public method

public InitCookie ( ) : void
return void

RandUserAgent() public method

public RandUserAgent ( ) : void
return void

SetAccept() public method

public SetAccept ( String accept ) : void
accept String
return void

SetContentType() public method

public SetContentType ( String type ) : void
type String
return void

SetCookiesString() public method

public SetCookiesString ( string c ) : void
c string
return void

SetEncoding() public method

设置当前编码
public SetEncoding ( Encoding en ) : void
en System.Text.Encoding
return void

SetTimeOut() public method

设置超时时间
public SetTimeOut ( int msec ) : void
msec int
return void

SetUserAgent() public method

设置UserAgent
public SetUserAgent ( String ua ) : void
ua String
return void

UrlEncode() public method

public UrlEncode ( string str ) : string
str string
return string