BE_Curl_Set_Option

BE_Curl_Set_Option ( { option ; value } )

 

Sets one of the Curl library optional variables, as used in all of the HTTP functions. The value depends on the type of option. Some require explicit values ( such as CURLOPT_USERAGENT ) and others require a flag. The full list of options and their possible values is in the curl documentation here: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html

Restoring all values to their default can be done with

BE_Curl_Set_Option

To return an option to it's default call the option name with no parameter :

BE_Curl_Set_Option ( "CURLOPT_HTTPAUTH" )

The CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options can also be set with the constants :

CURLAUTH_BASIC
CURLAUTH_DIGEST
CURLAUTH_DIGEST_IE
CURLAUTH_NEGOTIATE
CURLAUTH_NTLM
CURLAUTH_NTLM_WB
CURLAUTH_ANY
CURLAUTH_ANYSAFE
CURLAUTH_ONLY

Version : 2.1

Version : 3.1 - Made the option value optional and added named constants.

Parameters :
option ( optional ) : the name of the option to set.
value ( optional ) : the value to set it to.

Result : NA

 

Examples :

BE_Curl_Set_Option ( "CURLOPT_HTTPAUTH" ; 1 ) //Use "Basic" Authentication

BE_Curl_Set_Option ( "CURLOPT_HTTPAUTH" ) //Clear out any previous custom settings for this option

BE_Curl_Set_Option //Clear all custom options at once.

To use certificates for SSL Authentication you would do  :

BE_Curl_Set_Option ( "CURLOPT_SSLCERT" ; "/path/to/cert.pem" ) & 
BE_Curl_Set_Option ( "CURLOPT_SSLCERTTYPE" ; "PEM" ) & 
BE_Curl_Set_Option ( "CURLOPT_SSLKEY" ; "/path/to/key.pem" ) & 
BE_Curl_Set_Option ( "CURLOPT_SSLKEYTYPE" ; "PEM" )

"PEM" is the default type, so can be left out.  Other possible options for the types are "PEM", "DER" or "P12" for PKCS#12-encoded files.

 

 

Complete List of CURL options : 

CURLOPT_PROXY
CURLOPT_NOPROXY
CURLOPT_SOCKS5_GSSAPI_SERVICE
CURLOPT_INTERFACE
CURLOPT_NETRC_FILE
CURLOPT_USERPWD
CURLOPT_PROXYUSERPWD
CURLOPT_USERNAME
CURLOPT_PASSWORD
CURLOPT_PROXYUSERNAME
CURLOPT_PROXYPASSWORD
CURLOPT_TLSAUTH_USERNAME
CURLOPT_TLSAUTH_PASSWORD
CURLOPT_ACCEPT_ENCODING
CURLOPT_COPYPOSTFIELDS
CURLOPT_REFERER
CURLOPT_USERAGENT
CURLOPT_COOKIE
CURLOPT_COOKIEFILE
CURLOPT_COOKIEJAR
CURLOPT_COOKIELIST
CURLOPT_HTTPGET
CURLOPT_MAIL_FROM
CURLOPT_MAIL_AUTH
CURLOPT_FTPPORT
CURLOPT_FTP_ALTERNATIVE_TO_USER
CURLOPT_FTP_ACCOUNT
CURLOPT_RTSP_SESSION_ID
CURLOPT_RTSP_STREAM_URI
CURLOPT_RTSP_TRANSPORT
CURLOPT_RANGE
CURLOPT_CUSTOMREQUEST
CURLOPT_DNS_SERVERS
CURLOPT_SSLCERT
CURLOPT_SSLCERTTYPE
CURLOPT_SSLKEY
CURLOPT_SSLKEYTYPE
CURLOPT_KEYPASSWD
CURLOPT_SSLENGINE
CURLOPT_CAINFO
CURLOPT_ISSUERCERT
CURLOPT_CAPATH
CURLOPT_CRLFILE
CURLOPT_RANDOM_FILE
CURLOPT_EGDSOCKET
CURLOPT_SSL_CIPHER_LIST
CURLOPT_KRBLEVEL
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
CURLOPT_SSH_PUBLIC_KEYFILE
CURLOPT_SSH_PRIVATE_KEYFILE
CURLOPT_SSH_KNOWNHOSTS

CURLOPT_VERBOSE
CURLOPT_HEADER
CURLOPT_NOSIGNAL
CURLOPT_WILDCARDMATCH
CURLOPT_FAILONERROR
CURLOPT_PROXYPORT
CURLOPT_PROXYTYPE
CURLOPT_HTTPPROXYTUNNEL
CURLOPT_SOCKS5_GSSAPI_NEC
CURLOPT_LOCALPORT
CURLOPT_LOCALPORTRANGE
CURLOPT_DNS_CACHE_TIMEOUT
CURLOPT_DNS_USE_GLOBAL_CACHE
CURLOPT_BUFFERSIZE
CURLOPT_PORT
CURLOPT_TCP_NODELAY
CURLOPT_ADDRESS_SCOPE
CURLOPT_TCP_KEEPALIVE
CURLOPT_TCP_KEEPIDLE
CURLOPT_TCP_KEEPINTVL
CURLOPT_NETRC
CURLOPT_HTTPAUTH
CURLOPT_TLSAUTH_TYPE
CURLOPT_PROXYAUTH
CURLOPT_AUTOREFERER
CURLOPT_TRANSFER_ENCODING
CURLOPT_FOLLOWLOCATION
CURLOPT_UNRESTRICTED_AUTH
CURLOPT_MAXREDIRS
CURLOPT_PUT
CURLOPT_POST
CURLOPT_POSTFIELDSIZE
CURLOPT_COOKIESESSION
CURLOPT_HTTP_VERSION
CURLOPT_IGNORE_CONTENT_LENGTH
CURLOPT_HTTP_CONTENT_DECODING
CURLOPT_HTTP_TRANSFER_DECODING
CURLOPT_TFTP_BLKSIZE
CURLOPT_FTPPORT
CURLOPT_DIRLISTONLY
CURLOPT_APPEND
CURLOPT_FTP_USE_EPRT
CURLOPT_FTP_USE_EPSV
CURLOPT_FTP_USE_PRET
CURLOPT_FTP_CREATE_MISSING_DIRS
CURLOPT_FTP_RESPONSE_TIMEOUT
CURLOPT_FTP_SKIP_PASV_IP
CURLOPT_FTPSSLAUTH
CURLOPT_FTP_SSL_CCC
CURLOPT_FTP_FILEMETHOD
CURLOPT_RTSP_REQUEST
CURLOPT_RTSP_CLIENT_CSEQ
CURLOPT_RTSP_SERVER_CSEQ
CURLOPT_TRANSFERTEXT
CURLOPT_PROXY_TRANSFER_MODE
CURLOPT_CRLF
CURLOPT_RESUME_FROM
CURLOPT_FILETIME
CURLOPT_NOBODY
CURLOPT_INFILESIZE
CURLOPT_UPLOAD
CURLOPT_MAXFILESIZE
CURLOPT_TIMECONDITION
CURLOPT_TIMEVALUE
CURLOPT_TIMEOUT
CURLOPT_TIMEOUT_MS
CURLOPT_LOW_SPEED_TIME
CURLOPT_MAXCONNECTS
CURLOPT_FRESH_CONNECT
CURLOPT_FORBID_REUSE
CURLOPT_CONNECTTIMEOUT
CURLOPT_CONNECTTIMEOUT_MS
CURLOPT_IPRESOLVE
CURLOPT_CONNECT_ONLY
CURLOPT_USE_SSL
CURLOPT_ACCEPTTIMEOUT_MS
CURLOPT_SSLENGINE_DEFAULT
CURLOPT_SSLVERSION
CURLOPT_SSL_VERIFYPEER
CURLOPT_SSL_VERIFYHOST
CURLOPT_CERTINFO
CURLOPT_SSL_SESSIONID_CACHE
CURLOPT_GSSAPI_DELEGATION
CURLOPT_SSH_AUTH_TYPES
CURLOPT_NEW_FILE_PERMS
CURLOPT_NEW_DIRECTORY_PERMS

CURLOPT_POSTFIELDSIZE_LARGE
CURLOPT_RESUME_FROM_LARGE
CURLOPT_INFILESIZE_LARGE
CURLOPT_MAXFILESIZE_LARGE
CURLOPT_MAX_SEND_SPEED_LARGE
CURLOPT_MAX_RECV_SPEED_LARGE

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.