欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP CURL函數(shù)庫

 更新時間:2008年10月20日 22:51:19   作者:  
PHP中的CURL函數(shù)庫集合

CURLOPT_DNS_CACHE_TIMEOUT
設(shè)置在內(nèi)存中保存DNS信息的時間,默認為120秒。

CURLOPT_FTPSSLAUTH
The FTP authentication method (when is activated): CURLFTPAUTH_SSL (try SSL first), CURLFTPAUTH_TLS (try TLS first), or CURLFTPAUTH_DEFAULT (let cURL decide).

CURLOPT_HTTP_VERSION
設(shè)置curl使用的HTTP協(xié)議,CURL_HTTP_VERSION_NONE(讓curl自己判斷),CURL_HTTP_VERSION_1_0(HTTP/1.0),CURL_HTTP_VERSION_1_1(HTTP/1.1)

CURLOPT_HTTPAUTH
使用的HTTP驗證方法,可選的值有:CURLAUTH_BASIC,CURLAUTH_DIGEST,CURLAUTH_GSSNEGOTIATE,CURLAUTH_NTLM,CURLAUTH_ANY,CURLAUTH_ANYSAFE,可以使用“|”操作符分隔多個值,curl讓服務(wù)器選擇一個支持最好的值,CURLAUTH_ANY等價于CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM,CURLAUTH_ANYSAFE等價于CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM

CURLOPT_INFILESIZE
設(shè)定上傳文件的大小

CURLOPT_LOW_SPEED_LIMIT
當傳輸速度小于CURLOPT_LOW_SPEED_LIMIT時,PHP會根據(jù)CURLOPT_LOW_SPEED_TIME來判斷是否因太慢而取消傳輸。

CURLOPT_LOW_SPEED_TIME
The number of seconds the transfer should be below CURLOPT_LOW_SPEED_LIMIT for PHP to consider the transfer too slow and abort.
當傳輸速度小于CURLOPT_LOW_SPEED_LIMIT時,PHP會根據(jù)CURLOPT_LOW_SPEED_TIME來判斷是否因太慢而取消傳輸。

CURLOPT_MAXCONNECTS
允許的最大連接數(shù)量,超過是會通過CURLOPT_CLOSEPOLICY決定應(yīng)該停止哪些連接

CURLOPT_MAXREDIRS
指定最多的HTTP重定向的數(shù)量,這個選項是和CURLOPT_FOLLOWLOCATION一起使用的。

CURLOPT_PORT
一個可選的用來指定連接端口的量

CURLOPT_PROXYAUTH
The HTTP authentication method(s) to use for the proxy connection. Use the same bitmasks as described in CURLOPT_HTTPAUTH. For proxy authentication, only CURLAUTH_BASIC and CURLAUTH_NTLM are currently supported.

CURLOPT_PROXYPORT
The port number of the proxy to connect to. This port number can also be set in CURLOPT_PROXY.

CURLOPT_PROXYTYPE
Either CURLPROXY_HTTP (default) or CURLPROXY_SOCKS5.

CURLOPT_RESUME_FROM
在恢復(fù)傳輸時傳遞一個字節(jié)偏移量(用來斷點續(xù)傳)

CURLOPT_SSL_VERIFYHOST
1 to check the existence of a common name in the SSL peer certificate.
2 to check the existence of a common name and also verify that it matches the hostname provided.

CURLOPT_SSLVERSION
The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although in some cases this must be set manually.

CURLOPT_TIMECONDITION
如果在CURLOPT_TIMEVALUE指定的某個時間以后被編輯過,則使用CURL_TIMECOND_IFMODSINCE返回頁面,如果沒有被修改過,并且CURLOPT_HEADER為true,則返回一個"304 Not Modified"的header,CURLOPT_HEADER為false,則使用CURL_TIMECOND_ISUNMODSINCE,默認值為CURL_TIMECOND_IFMODSINCE

CURLOPT_TIMEOUT
設(shè)置curl允許執(zhí)行的最長秒數(shù)

CURLOPT_TIMEVALUE
設(shè)置一個CURLOPT_TIMECONDITION使用的時間戳,在默認狀態(tài)下使用的是CURL_TIMECOND_IFMODSINCE

CURLOPT_CAINFO
The name of a file holding one or more certificates to verify the peer with. This only makes sense when used in combination with CURLOPT_SSL_VERIFYPEER.

CURLOPT_CAPATH
A directory that holds multiple CA certificates. Use this option alongside CURLOPT_SSL_VERIFYPEER.

CURLOPT_COOKIE
設(shè)定HTTP請求中“Set-Cookie:”部分的內(nèi)容。

CURLOPT_COOKIEFILE
包含cookie信息的文件名稱,這個cookie文件可以是Netscape格式或者HTTP風(fēng)格的header信息。

CURLOPT_COOKIEJAR
連接關(guān)閉以后,存放cookie信息的文件名稱

CURLOPT_CUSTOMREQUEST
A custom request method to use instead of "GET" or "HEAD" when doing a HTTP request. This is useful for doing "DELETE" or other, more obscure HTTP requests. Valid values are things like "GET", "POST", "CONNECT" and so on; i.e. Do not enter a whole HTTP request line here. For instance, entering "GET /index.html HTTP/1.0\r\n\r\n" would be incorrect.
Note: Don't do this without making sure the server supports the custom request method first.

CURLOPT_EGBSOCKET
Like CURLOPT_RANDOM_FILE, except a filename to an Entropy Gathering Daemon socket.

CURLOPT_ENCODING
header中“Accept-Encoding: ”部分的內(nèi)容,支持的編碼格式為:"identity","deflate","gzip"。如果設(shè)置為空字符串,則表示支持所有的編碼格式

CURLOPT_FTPPORT
The value which will be used to get the IP address to use for the FTP "POST" instruction. The "POST" instruction tells the remote server to connect to our specified IP address. The string may be a plain IP address, a hostname, a network interface name (under Unix), or just a plain '-' to use the systems default IP address.

CURLOPT_INTERFACE
在外部網(wǎng)絡(luò)接口中使用的名稱,可以是一個接口名,IP或者主機名。

CURLOPT_KRB4LEVEL
KRB4(Kerberos 4)安全級別的設(shè)置,可以是一下幾個值之一:"clear","safe","confidential","private"。默認的值為"private",設(shè)置為null的時候表示禁用KRB4,現(xiàn)在KRB4安全僅能在FTP傳輸中使用。

CURLOPT_POSTFIELDS
在HTTP中的“POST”操作。如果要傳送一個文件,需要一個@開頭的文件名

CURLOPT_PROXY
設(shè)置通過的HTTP代理服務(wù)器

CURLOPT_PROXYUSERPWD
連接到代理服務(wù)器的,格式為“[username]:[password]”的用戶名和密碼。

CURLOPT_RANDOM_FILE
設(shè)定存放SSL用到的隨機數(shù)種子的文件名稱

CURLOPT_RANGE
設(shè)置HTTP傳輸范圍,可以用“X-Y”的形式設(shè)置一個傳輸區(qū)間,如果有多個HTTP傳輸,則使用逗號分隔多個值,形如:"X-Y,N-M"。

CURLOPT_REFERER
設(shè)置header中"Referer: " 部分的值。

CURLOPT_SSL_CIPHER_LIST
A list of ciphers to use for SSL. For example, RC4-SHA and TLSv1 are valid cipher lists.

CURLOPT_SSLCERT
傳遞一個包含PEM格式證書的字符串。

CURLOPT_SSLCERTPASSWD
傳遞一個包含使用CURLOPT_SSLCERT證書必需的密碼。

CURLOPT_SSLCERTTYPE
The format of the certificate. Supported formats are "PEM" (default), "DER", and "ENG".

CURLOPT_SSLENGINE
The identifier for the crypto engine of the private SSL key specified in CURLOPT_SSLKEY.

CURLOPT_SSLENGINE_DEFAULT
The identifier for the crypto engine used for asymmetric crypto operations.

CURLOPT_SSLKEY
The name of a file containing a private SSL key.

CURLOPT_SSLKEYPASSWD
The secret password needed to use the private SSL key specified in CURLOPT_SSLKEY.
Note: Since this option contains a sensitive password, remember to keep the PHP script it is contained within safe.

CURLOPT_SSLKEYTYPE
The key type of the private SSL key specified in CURLOPT_SSLKEY. Supported key types are "PEM" (default), "DER", and "ENG".

CURLOPT_URL
需要獲取的URL地址,也可以在PHP的curl_init()函數(shù)中設(shè)置。

CURLOPT_USERAGENT
在HTTP請求中包含一個”user-agent”頭的字符串。

CURLOPT_USERPWD
傳遞一個連接中需要的用戶名和密碼,格式為:“[username]:[password]”。

CURLOPT_HTTP200ALIASES
設(shè)置不再以error的形式來處理HTTP 200的響應(yīng),格式為一個數(shù)組。

CURLOPT_HTTPHEADER
設(shè)置一個header中傳輸內(nèi)容的數(shù)組。

CURLOPT_POSTQUOTE
An array of FTP commands to execute on the server after the FTP request has been performed.

CURLOPT_QUOTE
An array of FTP commands to execute on the server prior to the FTP request.

CURLOPT_FILE
設(shè)置輸出文件的位置,值是一個資源類型,默認為STDOUT (瀏覽器)。

CURLOPT_INFILE
在上傳文件的時候需要讀取的文件地址,值是一個資源類型。

CURLOPT_STDERR
設(shè)置一個錯誤輸出地址,值是一個資源類型,取代默認的STDERR。

CURLOPT_WRITEHEADER
設(shè)置header部分內(nèi)容的寫入的文件地址,值是一個資源類型。

CURLOPT_HEADERFUNCTION
設(shè)置一個回調(diào)函數(shù),這個函數(shù)有兩個參數(shù),第一個是curl的資源句柄,第二個是輸出的header數(shù)據(jù)。header數(shù)據(jù)的輸出必須依賴這個函數(shù),返回已寫入的數(shù)據(jù)大小。

CURLOPT_PASSWDFUNCTION
設(shè)置一個回調(diào)函數(shù),有三個參數(shù),第一個是curl的資源句柄,第二個是一個密碼提示符,第三個參數(shù)是密碼長度允許的最大值。返回密碼的值。

CURLOPT_READFUNCTION
設(shè)置一個回調(diào)函數(shù),有兩個參數(shù),第一個是curl的資源句柄,第二個是讀取到的數(shù)據(jù)。數(shù)據(jù)讀取必須依賴這個函數(shù)。返回讀取數(shù)據(jù)的大小,比如0或者EOF。

CURLOPT_WRITEFUNCTION
設(shè)置一個回調(diào)函數(shù),有兩個參數(shù),第一個是curl的資源句柄,第二個是寫入的數(shù)據(jù)。數(shù)據(jù)寫入必須依賴這個函數(shù)。返回精確的已寫入數(shù)據(jù)的大小

curl_copy_handle()函數(shù)的作用是拷貝一個curl連接資源的所有內(nèi)容和參數(shù)

<?php
$ch = curl_init("http://www.baidu.com/");
$another = curl_copy_handle($ch);
curl_exec($another);
curl_close($another);
?>
curl_error()函數(shù)的作用是返回一個包含當前會話錯誤信息的字符串。
curl_errno()函數(shù)的作用是返回一個包含當前會話錯誤信息的數(shù)字編號。

curl_multi_init()函數(shù)的作用是初始化一個curl批處理句柄資源。
curl_multi_add_handle()函數(shù)的作用是向curl批處理會話中添加單獨的curl句柄資源。curl_multi_add_handle()函數(shù)有兩個參數(shù),第一個參數(shù)表示一個curl批處理句柄資源,第二個參數(shù)表示一個單獨的curl句柄資源。
curl_multi_exec()函數(shù)的作用是解析一個curl批處理句柄,curl_multi_exec()函數(shù)有兩個參數(shù),第一個參數(shù)表示一個批處理句柄資源,第二個參數(shù)是一個引用值的參數(shù),表示剩余需要處理的單個的curl句柄資源數(shù)量。
curl_multi_remove_handle()函數(shù)表示移除curl批處理句柄資源中的某個句柄資源,curl_multi_remove_handle()函數(shù)有兩個參數(shù),第一個參數(shù)表示一個curl批處理句柄資源,第二個參數(shù)表示一個單獨的curl句柄資源。
curl_multi_close()函數(shù)的作用是關(guān)閉一個批處理句柄資源。

<?php
$ch1 = curl_init();
$ch2 = curl_init();

curl_setopt($ch1, CURLOPT_URL, "http://www.baidu.com/");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.google.com/");
curl_setopt($ch2, CURLOPT_HEADER, 0);

$mh = curl_multi_init();

curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);

do {
curl_multi_exec($mh,$flag);
} while ($flag > 0);

curl_multi_remove_handle($mh,$ch1);
curl_multi_remove_handle($mh,$ch2);
curl_multi_close($mh);
?>
curl_multi_getcontent()函數(shù)的作用是在設(shè)置了CURLOPT_RETURNTRANSFER的情況下,返回獲取的輸出的文本流。

curl_multi_info_read()函數(shù)的作用是獲取當前解析的curl的相關(guān)傳輸信息。

curl_multi_select()
Get all the sockets associated with the cURL extension, which can then be "selected"

相關(guān)文章

最新評論