php.curl參數(shù)詳解_第1頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、php.curl參數(shù)詳解tion)curl_close - 關(guān)閉一個curl會話curl_copy_handle - 拷貝一個curl銜接資源的全部內(nèi)容和參數(shù)curl_errno - 返回一個包含當(dāng)前會話錯誤信息的數(shù)字編號curl_error - 返回一個包含當(dāng)前會話錯誤信息的字符串curl_ec - 執(zhí)行一個curl會話curl_getinfo - 獵取一個curl銜接資源句柄的信息curl_init - 初始化一個curl會話curl_multi_a_handle - 向curl批處理睬話中添加單獨的curl句柄資源curl_multi_close - 關(guān)閉一個批處理句柄資源curl_mu

2、lti_exec - 解析一個curl批處理句柄curl_multi_getcontent - 返回獵取的輸出的文本流curl_multi_info_read - 獵取當(dāng)前解析的curl的相關(guān)傳輸信息curl_multi_init - 初始化一個curl批處理句柄資源curl_multi_remove_handle - 移除curl批處理句柄資源中的某個句柄資源curl_multi_select - get all the sockets associat with the curl extension, can then be "selected"curl_opt_arr

3、ay - 以數(shù)組的形式為一個curl設(shè)置會話參數(shù)curl_setopt - 為一個curl設(shè)置會話參數(shù)curl_version - 獵取curl相關(guān)的版本信息curl_init()函數(shù)的作用初始化一個curl會話,curl_init()函數(shù)唯一的一個參數(shù)是可選的,表示一個url地址。curl_exec()函數(shù)的作用是執(zhí)行一個curl會話,唯一的參數(shù)是curl_init()函數(shù)返回的句柄。curl_close()函數(shù)的作用是關(guān)閉一個curl會話,唯一的參數(shù)是curl_init()函數(shù)返回的句柄。$ch = curl_init(" curl_version()函數(shù)的作用是獵取curl相關(guān)

4、的版本信息,curl_version()函數(shù)有一個參數(shù),不清晰是做什么的可設(shè)置的參數(shù)有:curlopt_autoreferer自動設(shè)置header中的referer信息curlopt_binarytransfer在啟用curlopt_returntransfer時候?qū)C取數(shù)據(jù)返回curlopt_cookiesession啟用時curl會僅僅傳遞一個session cookie,忽視其他的cookie,默認(rèn)情況下curl會將全部的cookie返回給服務(wù)端。session cookie是指那些用來推斷服務(wù)器端的session是否有效而存在的cookie。curlopt_crlf啟用時將unix的換

5、行符轉(zhuǎn)換成回車換行符。curlopt_dns_use_global_cache啟用時會啟用一個全局的dns緩存,此項為線程平安的,并且默認(rèn)為ue。curlopt_failonerror顯示http狀態(tài)碼,默認(rèn)行為是忽視編號小于等于400的http信息curlopt_filetime啟用時會嘗試修改遠(yuǎn)程文檔中的信息。結(jié)果信息會通過curl_getinfo()函數(shù)的curlinfo_filetime選項返回。curlopt_followlocation啟用時會將服務(wù)器服務(wù)器返回的"loion:"放在header中遞歸的返回給服務(wù)器,用法curlopt_maxredirs可以限定

6、遞歸返回的數(shù)量。curlopt_forbid_reuse在完成交互以后強迫斷開銜接,不能重用。curlopt_fresh_connect強制獵取一個新的銜接,替代緩存中的銜接。curlopt_ftp_use_eprttrue to use eprt (and lprt) when doing active ftp downloads. use false to disable eprt and lprt and use port only.added in php 5.0.0.curlopt_ftp_use_epsvtrue to first try an epsv command for f

7、tp transfers before reverting back to pasv. set to false to disable epsv.curlopt_ftpappendtrue to append to the remote instead of overwriting it.curlopt_ftpasciian of curlopt_transfertext. use that instead.curlopt_ftplistonlytrue to only list the names of an ftp directory.curlopt_header啟用時會將頭文件的信息作為

8、數(shù)據(jù)流輸出。curlopt_httpget啟用時會設(shè)置http的method為get,由于get是默認(rèn)是,所以只在被修改的狀況下用法。curlopt_httpproxytunnel啟用時會通過http代理來傳輸。curlopt_mute講curl函數(shù)中全部修改過的參數(shù)復(fù)原默認(rèn)值。curlopt_netrc在銜接建立以后,拜訪/.netrc文件獵取用戶名和密碼信息銜接遠(yuǎn)程站點。curlopt_nobody啟用時將不對html中的body部分舉行輸出。curlopt_noprogress啟用時關(guān)閉curl傳輸?shù)倪M(jìn)度條,此項的默認(rèn)設(shè)置為truecurlopt_nosignal啟用時忽視全部的curl

9、傳遞給php舉行的信號。在sapi多線程傳輸時此項被默認(rèn)打開。curlopt_post啟用時會發(fā)送一個常規(guī)的post哀求,類型為:application/x-www-fo-urlencoded,就像表單提交的一樣。curlopt_put啟用時允許http發(fā)送文件,必需同時設(shè)置curlopt_infile和curlopt_infilesizecurlopt_returntransfer講curl_exec()獵取的信息以文件流的形式返回,而不是挺直輸出。curlopt_ssl_verifypeerfalse to stop curl from verifying the peer's c

10、ertificate. alternate certificates to verify against can be specified with the curlopt_cainfo option or a certificate directory can be specified with the curlopt_capath option. curlopt_ssl_verifyhost may ao need to be true or false if curlopt_ssl_verifypeer is disabled (it defaults to 2). true by de

11、fault as of curl 7.10. default bundle installed as of curl 7.10.curlopt_transfertexttrue to use ascii mode for ftp transfers. for ldap, it retrieves data in plain text instead of html. on windows systems, it will not set stdout to binary mode.curlopt_unrestricted_auth在用法curlopt_followlocation產(chǎn)生的head

12、er中的多個locations中持續(xù)追加用戶名和密碼信息,即使域名已發(fā)生轉(zhuǎn)變。curlopt_upload啟用時允許文件傳輸curlopt_verbose啟用時會匯報全部的信息,存放在stderr或指定的curlopt_stderr中curlopt_buffersize每次獵取的數(shù)據(jù)中讀入緩存的大小,這個值每次都會被填滿。curlopt_closepolicy不是curlclosepolicy_least_recently_used就是curlclosepolicy_oldest,還存在另外三個,但是curl臨時還不支持。.curlopt_connecttimeout在發(fā)起銜接前等待的時光,假

13、如設(shè)置為0,則不等待。curlopt_dns_cache_timeout設(shè)置在內(nèi)存中保存dns信息的時光,默認(rèn)為120秒。curlopt_ftpsslauththe 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(讓cur

14、l自己推斷),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 | cur

15、lauth_gssnegotiate | curlauth_ntlm,curlauth_anysafe等價于curlauth_digest | curlauth_gssnegotiate | curlauth_ntlmcurlopt_infilesize設(shè)定上傳文件的大小curlopt_low_speed_limit當(dāng)傳輸速度小于curlopt_low_speed_limit時,php會按照curlopt_low_speed_time來推斷是否因太慢而取消傳輸。curlopt_low_speed_timethe number of seconds the transfer should be

16、below curlopt_low_speed_limit for php to consider the transfer too slow and abort.當(dāng)傳輸速度小于curlopt_low_speed_limit時,php會按照curlopt_low_speed_time來推斷是否因太慢而取消傳輸。curlopt_maxconnects允許的最大銜接數(shù)量,超過是會通過curlopt_closepolicy打算應(yīng)當(dāng)停止哪些銜接curlopt_maxredirs指定最多的http重定向的數(shù)量,這個選項是和curlopt_followlocation一起用法的。curlopt_port一

17、個可選的用來指定銜接端口的量curlopt_proxyauththe 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 pported.curlopt_proxyportthe port number of the proxy to connect to.

18、 this port number can also be set in curlopt_proxy.curlopt_proxytypeeither curlproxy_http (default) or curlproxy_socks5.curlopt_resume_from在復(fù)原傳輸時傳遞一個字節(jié)偏移量(用來斷點續(xù)傳)curlopt_ssl_verifyhost1 to check the existence of a common name in the ssl peer certificate.2 to check the existence of a common name and

19、also verify that it matches the hostname provided.curlopt_sslversionthe 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返回頁面,假如沒有被修改過,并且cu

20、rlopt_header為true,則返回一個"304 not modified"的header,curlopt_header為false,則用法curl_timecond_isunmodsince,默認(rèn)值為 curl_timecond_ifmodsincecurlopt_timeout設(shè)置curl允許執(zhí)行的最長秒數(shù)curlopt_timevalue設(shè)置一個curlopt_timecondition用法的時光戳,在默認(rèn)狀態(tài)下用法的是curl_timecond_ifmodsincecurlopt_cainfothe name of a file holding one or

21、certificates to verify the peer with. this only makes sense when u in combination with curlopt_ssl_verifypeer.curlopt_capatha directory that holds multiple ca certificates. use this option alongside curlopt_ssl_verifypeer.curlopt_cookie設(shè)定http哀求中"set-cookie:"部分的內(nèi)容。curlopt_cookiefile包含cookie

22、信息的文件名稱,這個cookie文件可以是netscape格式或者h(yuǎn)ttp風(fēng)格的header信息。curlopt_cookiejar銜接關(guān)閉以后,存放cookie信息的文件名稱curlopt_customrequesta 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. vali

23、d values are things like "get", "post", "connect" and so on; i.e. do not enter a le http request line here. for instance, entering "get /index.html http/1.0rnrn" would be incorrect.note: don't do this without making sure the server supports the custom requ

24、est method first.curlopt_egbsocketlike curlopt_random_file, except a filename to an entropy gathering daemon socket.curlopt_encodingheader中"accept-encoding: "部分的內(nèi)容,支持的編碼格式為:"identity","deflate","g"。假如設(shè)置為空字符串,則表示支持全部的編碼格式curlopt_ftpportthe value which will be u

25、sed 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

26、systems default ip address.curlopt_interface在外部網(wǎng)絡(luò)接口中用法的名稱,可以是一個接口名,ip或者主機名。curlopt_krb4levelkrb4(kerberos 4)平安級別的設(shè)置,可以是一下幾個值之一:"","safe","confidential","private"。默認(rèn)的值為 "private",設(shè)置為null的時候表示禁用krb4,現(xiàn)在krb4平安僅能在ftp傳輸中用法。curlopt_postfields在http中的"po

27、st"操作。假如要傳送一個文件,需要一個開始的文件名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中"ref

28、erer: " 部分的值。curlopt_ssl_cipher_lista 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_sslcerttypethe format of the certificate. supported formats are "pem"

29、; (default), "der", and "eng".curlopt_sslenginethe identifier for the crypto engine of the private ssl key specified in curlopt_sslkey.curlopt_sslengine_defaultthe identifier for the crypto engine used for asymmetric crypto operations.curlopt_sslkeythe name of a file containing a

30、 private ssl key.curlopt_sslkeypasswdthe 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_sslkeytypethe key type of the private ssl key specified in

31、 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è)置不

32、再以error的形式來處理http 200的響應(yīng),格式為一個數(shù)組。curlopt_httpheader設(shè)置一個header中傳輸內(nèi)容的數(shù)組。curlopt_postquotean array of ftp commands to exee on the server after the ftp request has been performed.curlopt_quotean array of ftp commands to execute on the server prior to the ftp request.curlopt_file設(shè)置輸出文件的位置,值是一個資源類型,默認(rèn)為std

33、out (掃瞄器)。curlopt_infile在上傳文件的時候需要讀取的文件地址,值是一個資源類型。curlopt_stderr設(shè)置一個錯誤輸出地址,值是一個資源類型,取代默認(rèn)的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的資源句柄,其

34、次個是一個密碼提醒符,第三個參數(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ù)$ch = curl_init(" = curl_copy_handle($ch);curl_exec($another);curl_close($another);? curl_exec($another);curl_close($another);? cu

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論