C# Class LibCurl.Curl

Inheritance: IDisposable
Show file Open project: trustme/LibCurlDotNet Class Usage Examples

Public Methods

Method Description
Cleanup ( ) : void

Cleanup all resources

DisableVerifySSL ( ) : void

Disable verify SSL

Dispose ( ) : void
EnableCookies ( string file ) : void

Enable cookies and read from the file specified. If the file is not present, it is not created. Use SaveCookies to save to the file.

GetCookies ( ) : SList

Get the current cookies. You must have already have called EnableCookies()

GetError ( CURLcode code ) : string

Get the curl error

GetObject ( IntPtr userdata ) : object

Returns the object passed to a Set...Data function. Cast back to the original object.

Perform ( ) : CURLcode

Perform the curl operation

SaveCookies ( string file ) : void

Save the cookies to the file specified.

SetCustomPostRequest ( ) : CURLcode

Custom "POST" request

SetDebugData ( object data ) : CURLcode

Object to pass to OnDebugCallback.

SetFollowLocation ( bool flag ) : CURLcode

Follow

SetHeader ( SList list ) : CURLcode

Set the Headers

SetHeaderData ( object data ) : CURLcode

Object to pass to OnHeaderCallback.

SetOpt ( CURLoption option, IntPtr param ) : CURLcode

Set the Curl option

SetOpt ( CURLoption option, long param ) : CURLcode

Set the Curl option

SetOpt ( CURLoption option, string parameter ) : CURLcode

Set the Curl option

SetPost ( ) : CURLcode

Post

SetPostFieldSize ( int size ) : CURLcode
SetPostFields ( string postFields ) : CURLcode

Set the post fields

SetProgressData ( object data ) : CURLcode

Object to pass to OnProgressCallback. Use curl.GetObject to convert the passed IntPtr back into the object, then cast.

SetPut ( ) : CURLcode

Put

SetReadData ( object data ) : CURLcode

Object to pass to OnReadCallback. Use curl.GetObject to convert the passed IntPtr back into the object, then cast.

SetTimeout ( int value ) : void

Response timeout

SetUpload ( ) : CURLcode

Upload

SetUploadSize ( int value ) : CURLcode

Set the size of the upload

SetUrl ( string url ) : CURLcode

Set the Url

SetUserAgent ( string agent ) : CURLcode

Set the user agent

SetWriteData ( object data ) : CURLcode

Object to pass to OnWriteCallback.

Verbose ( ) : void

Enable verbose messages

Version ( ) : string

Version of CUrl

Private Methods

Method Description
Curl ( ) : System
FreeHandle ( IntPtr &handle ) : void

Free the pinned object

GetHandle ( object obj ) : IntPtr

Pin the object in memory so the C function can find it

curl_easy_cleanup ( IntPtr pCurl ) : void
curl_easy_duphandle ( IntPtr pCurl ) : IntPtr
curl_easy_getinfo ( IntPtr pCurl, CURLINFO info, IntPtr &pInfo ) : CURLcode
curl_easy_getinfo_64 ( IntPtr pCurl, CURLINFO info, double &dblVal ) : CURLcode
curl_easy_init ( ) : IntPtr
curl_easy_perform ( IntPtr pCurl ) : CURLcode
curl_easy_reset ( IntPtr pCurl ) : void
curl_easy_setopt ( IntPtr pCurl, CURLoption opt, IntPtr parm ) : CURLcode
curl_easy_setopt ( IntPtr pCurl, CURLoption opt, _DebugCallbackDelegate callback ) : CURLcode
curl_easy_setopt ( IntPtr pCurl, CURLoption opt, _GenericCallbackDelegate callback ) : CURLcode
curl_easy_setopt ( IntPtr pCurl, CURLoption opt, _ProgressCallbackDelegate callback ) : CURLcode
curl_easy_setopt ( IntPtr pCurl, CURLoption opt, bool parm ) : CURLcode
curl_easy_setopt ( IntPtr pCurl, CURLoption opt, long parm ) : CURLcode
curl_easy_setopt ( IntPtr pCurl, CURLoption opt, string parm ) : CURLcode
curl_easy_strerror ( CURLcode err ) : IntPtr
curl_escape ( String url, int length ) : IntPtr
curl_formfree ( IntPtr pForm ) : void
curl_free ( IntPtr p ) : void
curl_global_cleanup ( ) : void
curl_global_init ( int flags ) : CURLcode
curl_multi_add_handle ( IntPtr pmulti, IntPtr peasy ) : CURLMcode
curl_multi_cleanup ( IntPtr pmulti ) : CURLMcode
curl_multi_init ( ) : IntPtr
curl_multi_perform ( IntPtr pmulti, int &runningHandles ) : CURLMcode
curl_multi_remove_handle ( IntPtr pmulti, IntPtr peasy ) : CURLMcode
curl_multi_strerror ( CURLMcode errorNum ) : IntPtr
curl_share_cleanup ( IntPtr pShare ) : CURLSHcode
curl_share_init ( ) : IntPtr
curl_share_setopt ( IntPtr pShare, CURLSHoption optCode, IntPtr option ) : CURLSHcode
curl_share_strerror ( CURLSHcode errorCode ) : IntPtr
curl_slist_append ( IntPtr slist, string data ) : IntPtr
curl_slist_free_all ( IntPtr pList ) : CURLSHcode
curl_unescape ( String url, int length ) : IntPtr
curl_version ( ) : IntPtr
curl_version_info ( CURLversion ver ) : IntPtr
internal_OnDebugCallback ( IntPtr ptrCurl, CURLINFOTYPE infoType, string message, int size, IntPtr ptrUserdata ) : int
internal_OnHeaderCallback ( IntPtr ptrBuffer, int sz, int nmemb, IntPtr ptrUserdata ) : int
internal_OnReadCallback ( IntPtr ptrBuffer, int sz, int nmemb, IntPtr ptrUserdata ) : int
internal_OnWriteCallback ( IntPtr ptrBuffer, int sz, int nmemb, IntPtr ptrUserdata ) : int
internal_ProgressCallback ( IntPtr ptrUserdata, double dlTotal, double dlNow, double ulTotal, double ulNow ) : int

Method Details

Cleanup() public method

Cleanup all resources
public Cleanup ( ) : void
return void

DisableVerifySSL() public method

Disable verify SSL
public DisableVerifySSL ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

EnableCookies() public method

Enable cookies and read from the file specified. If the file is not present, it is not created. Use SaveCookies to save to the file.
public EnableCookies ( string file ) : void
file string
return void

GetCookies() public method

Get the current cookies. You must have already have called EnableCookies()
public GetCookies ( ) : SList
return SList

GetError() public method

Get the curl error
public GetError ( CURLcode code ) : string
code CURLcode
return string

GetObject() public static method

Returns the object passed to a Set...Data function. Cast back to the original object.
public static GetObject ( IntPtr userdata ) : object
userdata IntPtr
return object

Perform() public method

Perform the curl operation
public Perform ( ) : CURLcode
return CURLcode

SaveCookies() public method

Save the cookies to the file specified.
public SaveCookies ( string file ) : void
file string
return void

SetCustomPostRequest() public method

Custom "POST" request
public SetCustomPostRequest ( ) : CURLcode
return CURLcode

SetDebugData() public method

Object to pass to OnDebugCallback.
public SetDebugData ( object data ) : CURLcode
data object
return CURLcode

SetFollowLocation() public method

Follow
public SetFollowLocation ( bool flag ) : CURLcode
flag bool
return CURLcode

SetHeader() public method

Set the Headers
public SetHeader ( SList list ) : CURLcode
list SList
return CURLcode

SetHeaderData() public method

Object to pass to OnHeaderCallback.
public SetHeaderData ( object data ) : CURLcode
data object
return CURLcode

SetOpt() public method

Set the Curl option
public SetOpt ( CURLoption option, IntPtr param ) : CURLcode
option CURLoption
param IntPtr
return CURLcode

SetOpt() public method

Set the Curl option
public SetOpt ( CURLoption option, long param ) : CURLcode
option CURLoption
param long
return CURLcode

SetOpt() public method

Set the Curl option
public SetOpt ( CURLoption option, string parameter ) : CURLcode
option CURLoption
parameter string
return CURLcode

SetPost() public method

Post
public SetPost ( ) : CURLcode
return CURLcode

SetPostFieldSize() public method

public SetPostFieldSize ( int size ) : CURLcode
size int
return CURLcode

SetPostFields() public method

Set the post fields
public SetPostFields ( string postFields ) : CURLcode
postFields string
return CURLcode

SetProgressData() public method

Object to pass to OnProgressCallback. Use curl.GetObject to convert the passed IntPtr back into the object, then cast.
public SetProgressData ( object data ) : CURLcode
data object
return CURLcode

SetPut() public method

Put
public SetPut ( ) : CURLcode
return CURLcode

SetReadData() public method

Object to pass to OnReadCallback. Use curl.GetObject to convert the passed IntPtr back into the object, then cast.
public SetReadData ( object data ) : CURLcode
data object
return CURLcode

SetTimeout() public method

Response timeout
public SetTimeout ( int value ) : void
value int
return void

SetUpload() public method

Upload
public SetUpload ( ) : CURLcode
return CURLcode

SetUploadSize() public method

Set the size of the upload
public SetUploadSize ( int value ) : CURLcode
value int
return CURLcode

SetUrl() public method

Set the Url
public SetUrl ( string url ) : CURLcode
url string
return CURLcode

SetUserAgent() public method

Set the user agent
public SetUserAgent ( string agent ) : CURLcode
agent string
return CURLcode

SetWriteData() public method

Object to pass to OnWriteCallback.
public SetWriteData ( object data ) : CURLcode
data object
return CURLcode

Verbose() public method

Enable verbose messages
public Verbose ( ) : void
return void

Version() public static method

Version of CUrl
public static Version ( ) : string
return string