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

PHP CURL函數(shù)庫(kù)

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

CURLOPT_DNS_CACHE_TIMEOUT
設(shè)置在內(nèi)存中保存DNS信息的時(shí)間,默認(rèn)為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驗(yàn)證方法,可選的值有:CURLAUTH_BASIC,CURLAUTH_DIGEST,CURLAUTH_GSSNEGOTIATE,CURLAUTH_NTLM,CURLAUTH_ANY,CURLAUTH_ANYSAFE,可以使用“|”操作符分隔多個(gè)值,curl讓服務(wù)器選擇一個(gè)支持最好的值,CURLAUTH_ANY等價(jià)于CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM,CURLAUTH_ANYSAFE等價(jià)于CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM

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

CURLOPT_LOW_SPEED_LIMIT
當(dāng)傳輸速度小于CURLOPT_LOW_SPEED_LIMIT時(shí),PHP會(huì)根據(jù)CURLOPT_LOW_SPEED_TIME來(lái)判斷是否因太慢而取消傳輸。

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.
當(dāng)傳輸速度小于CURLOPT_LOW_SPEED_LIMIT時(shí),PHP會(huì)根據(jù)CURLOPT_LOW_SPEED_TIME來(lái)判斷是否因太慢而取消傳輸。

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

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

CURLOPT_PORT
一個(gè)可選的用來(lái)指定連接端口的量

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ù)傳輸時(shí)傳遞一個(gè)字節(jié)偏移量(用來(lái)斷點(diǎn)續(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指定的某個(gè)時(shí)間以后被編輯過(guò),則使用CURL_TIMECOND_IFMODSINCE返回頁(yè)面,如果沒(méi)有被修改過(guò),并且CURLOPT_HEADER為true,則返回一個(gè)"304 Not Modified"的header,CURLOPT_HEADER為false,則使用CURL_TIMECOND_ISUNMODSINCE,默認(rèn)值為CURL_TIMECOND_IFMODSINCE

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

CURLOPT_TIMEVALUE
設(shè)置一個(gè)CURLOPT_TIMECONDITION使用的時(shí)間戳,在默認(rèn)狀態(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請(qǐng)求中“Set-Cookie:”部分的內(nèi)容。

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

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

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ò)接口中使用的名稱(chēng),可以是一個(gè)接口名,IP或者主機(jī)名。

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

CURLOPT_POSTFIELDS
在HTTP中的“POST”操作。如果要傳送一個(gè)文件,需要一個(gè)@開(kāi)頭的文件名

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

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

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

CURLOPT_RANGE
設(shè)置HTTP傳輸范圍,可以用“X-Y”的形式設(shè)置一個(gè)傳輸區(qū)間,如果有多個(gè)HTTP傳輸,則使用逗號(hào)分隔多個(gè)值,形如:"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
傳遞一個(gè)包含PEM格式證書(shū)的字符串。

CURLOPT_SSLCERTPASSWD
傳遞一個(gè)包含使用CURLOPT_SSLCERT證書(shū)必需的密碼。

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請(qǐng)求中包含一個(gè)”user-agent”頭的字符串。

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

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

CURLOPT_HTTPHEADER
設(shè)置一個(gè)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è)置輸出文件的位置,值是一個(gè)資源類(lèi)型,默認(rèn)為STDOUT (瀏覽器)。

CURLOPT_INFILE
在上傳文件的時(shí)候需要讀取的文件地址,值是一個(gè)資源類(lèi)型。

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

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

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

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

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

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

curl_copy_handle()函數(shù)的作用是拷貝一個(gè)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ù)的作用是返回一個(gè)包含當(dāng)前會(huì)話(huà)錯(cuò)誤信息的字符串。
curl_errno()函數(shù)的作用是返回一個(gè)包含當(dāng)前會(huì)話(huà)錯(cuò)誤信息的數(shù)字編號(hào)。

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

<?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ù)的作用是獲取當(dāng)前解析的curl的相關(guān)傳輸信息。

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

相關(guān)文章

最新評(píng)論