PHP CURL curlopt parameter description (curl_setopt)

Source: Internet
Author: User
Tags ftp commands http 200 http authentication http cookie http post php script

Curlopt_returntransfer options: curl_setopt ($ch, curlopt_returntransfer,1);  If the result is successfully returned only, no content is automatically output. If the failure returns false curl_setopt ($ch, curlopt_returntransfer,0);  Or do not use this option: If success returns only true, the output returned automatically.  If the failure returns false in PHP, some parameters of the Curl Method curl_setopt () function. the bool curl_setopt (int ch, string option, mixed value) curl_setopt () function sets options for a curl session.  The option parameter is the setting that you want, and value is the one given by this choice. The values of the following options are used as long shapes (specified in the option parameter):? Curlopt_infilesize: When you upload a file to a remote site, this option tells PHP the size of your upload file. Curlopt_verbose: If you want curl to report every unexpected thing, set this option to a value other than 0. Curlopt_header: If you want to include a header in the output, set this option to a value other than 0. Curlopt_noprogress: If you do not have PHP display a process bar for the Curl transfer, set this option to a value other than 0. Note: PHP automatically sets this option to a value other than 0, you should only change this option for debugging purposes. Curlopt_nobody: If you do not want to include the body part in the output, set this option to a value other than 0. Curlopt_failonerror: If you want PHP to not display when an error occurs (HTTP code returns greater than or equal to 300), set this option to one person other than 0 value. The default behavior is to return a normal page, ignoring the code. Curlopt_upload: If you want PHP to prepare for uploading, set this option to a value other than 0. Curlopt_post: If you want PHP to do a regular HTTP POST, set this option to a value other than 0. This post is an ordinary application/x-www-from-urlencoded type, most of which is used by HTML forms. Curlopt_ftplistonly: Set this option to a value other than 0, PHP will list the list of directory names for FTP. Curlopt_ftpaPpend: Set this option to a value other than 0, PHP will apply the remote file instead of overwriting it. CURLOPT_NETRC: Set this option to a value other than 0, PHP will look in your ~./netrc file for the user name and password of the remote site you want to connect to. Curlopt_followlocation: Set this option to a non-0 value (like "Location:") of the head, the server will send it as part of the HTTP header (note that this is recursive, PHP will send a shape like "location:" the head). Curlopt_put: Set this option to use HTTP to upload a file for a value other than 0. To upload this file you must set the Curlopt_infile and Curlopt_infilesize options. Curlopt_mute: Set this option to a value other than 0, PHP will be completely silent for the curl function. Curlopt_timeout: Sets a long shape number, as the maximum continuation of how many seconds.? Curlopt_low_speed_limit: Sets a long shaping number, controlling how many bytes are transferred. Curlopt_low_speed_time: Sets a long shape number that controls how many seconds to transmit curlopt_low_speed_limit the specified number of bytes. Curlopt_resume_from: Pass a long shaping parameter that contains the byte offset address (the start form you want to transfer to). Curlopt_sslversion: Pass a long parameter that contains the SSL version. Default PHP will be determined by its own efforts, in more security you have to manually set. Curlopt_timecondition: Passes a long parameter that specifies how the Curlopt_timevalue parameter is handled. You can set this parameter to Timecond_ifmodsince or timecond_isunmodsince. This is used only for HTTP.? Curlopt_timevalue: Passes a number of seconds from 1970-1-1 onwards to the present.  This time will be used by the Curlopt_timevalue option as the specified value, or by default timecond_ifmodsince. The values of the following options will be used as strings:? Curlopt_url: This is the URL address you want to retrieve with PHP. You can also set this option when initializing with the Curl_init () function. Curlopt_userpwd: Passing a string that is shaped like [Username]:[password] style, functions PHPTo connect.? Curlopt_proxyuserpwd: Pass a string that is formatted as [Username]:[password] to connect to the HTTP proxy. Curlopt_range: Pass a range that you want to specify. It should be in the "X-y" format, except for X. or Y. HTTP delivery also supports several intervals, separated by a phrase (x-y,n-m). Curlopt_postfields: A string that passes all data as an HTTP "POST" operation. Curlopt_referer: A string that contains a "REFERER" header in an HTTP request. Curlopt_useragent: A string that contains a "user-agent" header in an HTTP request. Curlopt_ftpport: Pass an IP address that contains the FTP "POST" instruction used. This post command tells the remote server to connect to the IP address we specified. This string can be an IP address, a host name, a network interface name (under Unix), or '-' (using the system default IP address). Curlopt_cookie: Pass a header connection that contains an HTTP COOKIE. Curlopt_sslcert: Pass a string containing a certificate in PEM format. CURLOPT_SSLCERTPASSWD: Pass a password that contains required to use the Curlopt_sslcert certificate. Curlopt_cookiefile: A string that passes the name of a file that contains cookie data. This cookie file can be the Netscape format, or the HTTP style header that is stockpiled in the file. Curlopt_customrequest: When an HTTP request is made, passing a character is used by get or head. For a delete or other operation is beneficial, more pass a string to is used instead of GET or HEAD when doing an HTTP request. This was useful for doing or another, and more obscure, HTTP request. Note: Do not do this before confirming your server support commands. The following options require a file description (obtained by using the fopen () function):? Curlopt_file: This file will be the output file you placed the transfer, the default is stdout. Curlopt_infile: This file is your biographyThe input file sent over.? Curlopt_writeheader: This file is written with the head part of your output. Curlopt_stderr: This file is written with errors rather than STDERR.  To get an example of a page that needs to be signed in, the current practice is to log in once every time, and the person who needs to do it is improved. Example one: Copy code code as follows: $cookie _jar = Tempnam ('./tmp ', ' Cookie '); $ch = Curl_init (); curl_setopt ($ch, Curlopt_url,//****** '); curl_setopt ($ch, Curlopt_post, 1); $request = ' email_address=&password= &action= '; curl_setopt ($ch, Curlopt_postfields, $request); Keep the returned cookie information in the $cookie_jar file curl_setopt ($ch, Curlopt_cookiejar, $cookie _jar); Sets whether the returned data is automatically displayed curl_setopt ($ch, Curlopt_returntransfer, 1); Sets whether to display header information curl_setopt ($ch, Curlopt_header, false); Sets whether to output page content curl_setopt ($ch, Curlopt_nobody, false); curl_exec ($ch); Curl_close ($ch); Get data After login example two: Copy code code as follows: $ch 2 = Curl_init (); curl_setopt ($ch 2, Curlopt_url,//***** '); curl_setopt ($ch 2, C Urlopt_header, False); curl_setopt ($ch 2, Curlopt_returntransfer, 1); curl_setopt ($ch 2, Curlopt_cookiefile, $cookie _  jar); $orders = Curl_exec ($ch 2); Echo '; echo Strip_tags ($orders); Echo '; Curl_close ($ch 2);  The practice proved very stable:) Example three:    Copy the code code as follows: Set_time_limit (0), function _rand () {$length =26; $chars = "0123456789abcdefghijklmnopqrstuvwxyz"; $max = Strl En ($chars)-1;mt_srand ((double) microtime () * 1000000), $string = ", for ($i = 0; $i < $length; $i + +) {$string. = $chars [ Mt_rand (0, $max)];} return $string;} $HTTP _session=_rand (), Echo $HTTP _session, $HTTP _server= ""; $HTTP _url= "/"; $ch = Curl_init (); curl_setopt ($ch, Curlopt_ url,//". $HTTP _server. $HTTP _url); curl_setopt ($ch, curlopt_returntransfer,true); curl_setopt ($ch, curlopt_useragent , "mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;. NET CLR 1.1.4322;. NET CLR 2.0.50727);//curl_setopt ($ch, Curlopt_cookie, $HTTP _session); $res = Curl_exec ($ch);  Curl_close ($ch);p rint_r ($res); Brush Forum Code: 1, catch the cookie program: Copy the Code as follows: $URL = "action=chk";//fill in the Forum landing page Address $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $URL); curl_setopt ($ch, Curlopt_referer, "");//Set, access the page's source address curl_setopt ($ch, curlopt_post,1); curl_setopt ($ch, Curlopt_ Postfields, ' username=→→ expendables →&password=168168 ');//Analysis landing page, the user name, password, respectivelyCorresponds to curl_setopt ($ch, curlopt_header,true);//enable display of HTTP headers, curl_exec ($ch), if (Curl_errno ($ch)) {print curl_error ($ch);}  Else{curl_close ($ch);} 2, Brush the building: Copy the Code as follows: Set_time_limit (0);//Set Program execution time unlimited $i=10000;//play 10,000 times for ($j =0; $j < $i; $j + +) {$URL = "";// This address is the URL address of the action in the reply form $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $URL); curl_setopt ($ch, Curlopt_referer, "? Boardid=14&replyid=672709&id=127437&page=1&skin=0&star=53 ");//Set the source address, if not set, Forum server may have authentication not allowed to reply curl_setopt ($ch, curlopt_cookiesession,true);//Can save Cookiecurl_setopt ($ch, Curlopt_cookie, "Dvforum =userid=24122&usercookies=0&userhidden=2&password=w0reu3g775vry745&userclass=%96%7c& username=%a1%fa%a1%fa%b8%d2%cb%c0%b6%d3%a1%fa&statuserid=2194783945 ");//Here is the cookie set curl_setopt ($ch, curlopt_post,1) curl_setopt ($ch, curlopt_nobody,1);//Do not display content, because there are many forums to automatically jump after the reply. curl_setopt ($ch, Curlopt_postfields, ' body=gfdfgdfgasdfgdfgdfgdfg& Followup=672709&rootid=127437&star =58&totalusetable=dv_bbs3& amp; Username=→→ expendables →&signflag=1&total=65535 ');//Assign the parameters of the reply form you analyzed curl_setopt ($ch, curlopt_header,true); curl_exec ($ch); if (Curl_errno ($ch)) {print curl_error ($ch);}  Else{curl_close ($ch);}} Curl_close-close a Curl session curl_copy_handle-copy all contents and parameters of a Curl connection resource curl_errno-Returns a numeric number containing the current session error information curl_error- Returns a string containing the current session error information curl_exec-performs a curl session curl_getinfo-gets information about a Curl connection resource handle curl_init-Initializes a curl session Curl_multi_add_handle -Add a separate curl handle resource to the Curl batch session curl_multi_close-closes a batch handle resource curl_multi_exec-Resolves a curl batch handle curl_multi_getcontent- Returns the text stream of the obtained output curl_multi_info_read-gets the related transport information for the currently resolved Curl curl_multi_init-Initializes a curl batch handle resource curl_multi_remove_handle- Remove a handle resource from the CURL batch handle resource Curl_multi_select-get all the sockets associated with the CURL extension, which can and be "select Ed "curl_setopt_array-Sets the session parameter for a curl as an array curl_setopt-set session parameters for a curl curl_version-get curl related version information Curl_init () Function Initializes a curl session, the only parameter of the Curl_init () function is optional and represents a URL address. The function of the curl_exec () function is to perform a curl session, and the only argument is the handle returned by the Curl_init () function. The role of the Curl_close () function is to close a curl session, with the only argument being CThe handle returned by the Url_init () function. $ch = Curl_init (""), Curl_exec ($ch), Curl_close ($ch), curl_version () function is to get the version information related to curl, the curl_version () function has a parameter, Not sure what to do. The Print_r (Curl_version ()) Curl_getinfo () function is to get information about a Curl connection resource handle, the Curl_getinfo () function has two parameters, the first parameter is the resource handle of curl, The second parameter is the following constants: $ch = Curl_init ("");p Rint_r (Curl_getinfo ($ch)), and optional constants include: Curlinfo_effective_url last valid URL address curlinfo_ Http_code the last HTTP code received curlinfo_filetime the time to obtain the document remotely, and if not, the return value is "1" curlinfo_total_time the last time the transfer was consumed Curlinfo_ Namelookup_time the time consumed by name resolution Curlinfo_connect_time the time it takes to establish a connection curlinfo_pretransfer_time the time it takes to establish the connection to prepare the transfer curlinfo_ Starttransfer_time The amount of time that is used to start the connection to the beginning of the transfer curlinfo_redirect_time the time it takes to redirect before the transaction transfer begins curlinfo_size_upload The total value of the uploaded data curlinfo_ Size_download Download Data volume curlinfo_speed_download average download speed curlinfo_speed_upload average upload speed curlinfo_header_ The size of the Sizeheader section curlinfo_header_out the size of the requested string curlinfo_request_size the request that has the problem in the HTTP request Curlinfo_ssl_ Verifyresultresult of SSL certification verification requested by setting Curlopt_ssl_verifypeercurlinfo_content_ Length_download from Content-length: The download content length read in field curlinfo_content_length_upload the upload content size description curlinfo_content_type the "Content-type" value of the downloaded content, Null indicates that the server did not send a valid "Content-type:header" curl_setopt () function to set the session parameters for a curl.    The function of the Curl_setopt_array () function is to set the session parameters for a curl in the form of an array. Copy the code as follows: $ch = Curl_init (), $fp = fopen ("Example_homepage.txt", "W"), curl_setopt ($ch, Curlopt_file, $fp); $options = Arra Y (Curlopt_url = ", Curlopt_header = False); Curl_setopt_array ($ch, $options); curl_exec ($ch); Curl_close ($ch);  Fclose ($FP); The parameters that can be set are: Curlopt_autoreferer automatically sets the Referer information in the header Curlopt_binarytransfer enabled Curlopt_ Returntransfer will get the data back when Curlopt_cookiesession is enabled, curl will simply pass a session cookie, ignoring other cookies, and by default curl will return all cookies to the server. Session cookies are cookies that are used to determine if the session on the server is valid. Curlopt_crlf converts a Unix newline character to a carriage return line break when enabled. When Curlopt_dns_use_global_cache is enabled, a global DNS cache is enabled, which is thread-safe and is true by default. Curlopt_failonerror Displays the HTTP status code, the default behavior is to ignore HTTP information that is less than or equal to 400, and when Curlopt_filetime is enabled, attempts to modify the information in the remote document. The resulting information is returned through the curlinfo_filetime option of the Curl_getinfo () function. When Curlopt_followlocation is enabled, "Location:" returned by the server server is placed in the header recursivelyReturns to the server, using Curlopt_maxredirs to limit the number of recursive returns. Curlopt_forbid_reuse Force disconnects after completing the interaction and cannot be reused. Curlopt_fresh_connect forces a new connection to be taken in place of the connection in the cache. 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 a EPSV command for FTP transfers before reverting back to PASV. Set to FALSE to disable EPSV. Curlopt_ftpappendtrue to append to the remote file instead of overwriting it. Curlopt_ftpasciian alias of Curlopt_transfertext. Use that instead. Curlopt_ftplistonlytrue to list the names of an FTP directory. When Curlopt_header is enabled, the information for the header file is output as a data stream. When Curlopt_httpget is enabled, the method for HTTP is set to get, because get is the default, so it is used only if it is modified. Curlopt_httpproxytunnel is transmitted through an HTTP proxy when it is enabled. Curlopt_mute all the modified parameters in the Curl function to restore the default values. CURLOPT_NETRC After the connection is established, access the ~RC file to get the user name and password information to connect to the remote site. Curlopt_nobody will not output the body part of HTML when it is enabled. Curlopt_noprogress turn off the progress bar of the curl transfer when enabled, the default setting for this entry is truecurlopt_nosignal enabled when ignoring all the signals that curl passes to PHP. This entry is turned on by default when SAPI multi-threaded transmissions. When Curlopt_post is enabled, a regular post request is sent, and the classType: application/x-www-form-urlencoded, just like the form submitted. Curlopt_put allow HTTP to send files when enabled, both Curlopt_infile and Curlopt_infilesizecurlopt_returntransfer must be set to speak Curl_exec () The information obtained is returned in the form of a file stream, rather than directly output. Curlopt_ssl_verifypeerfalse to stop CURL from verifying the peer ' s certificate. Alternate certificates to verify against can is specified with the Curlopt_cainfo option or a certificate directory can is Specified with the Curlopt_capath option. Curlopt_ssl_verifyhost may also need to be TRUE or FALSE if curlopt_ssl_verifypeer are disabled (it defaults to 2). TRUE by default 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 the data in plain text instead of HTML. On Windows systems, it won't set STDOUT to binary mode. Curlopt_unrestricted_auth continuously appends user name and password information to multiple locations in the header generated by curlopt_followlocation, even if the domain name has changed. Curlopt_upload allow file transfer when enabled Curlopt_verbose all information is reported when enabled, stored in stderr or specified Curlopt_stderr curlopt_ BufferSize reads the size of the cache each time it gets data, this value is filled every time.Curlopt_closepolicy is not curlclosepolicy_least_recently_used is curlclosepolicy_oldest, there are three other, but Curl temporarily does not support. Curlopt_connecttimeout the time to wait before initiating the connection and, if set to 0, does not wait. Curlopt_dns_cache_timeout sets the time to save DNS information in memory by default of 120 seconds. 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 set Curl to use the HTTP protocol, Curl_http_version_none (let CURL himself judge), Curl_http_version_1_0 (http/1.0), Curl_ Http_version_1_1 (http/1.1) Curlopt_httpauth uses the HTTP authentication method, the optional values are: Curlauth_basic,curlauth_digest,curlauth_ Gssnegotiate,curlauth_ntlm,curlauth_any,curlauth_anysafe, you can use the "|" operator to separate multiple values, curl allows the server to select one of the best supported values, Curlauth_any equivalent to Curlauth_basic | Curlauth_digest | Curlauth_gssnegotiate | Curlauth_ntlm,curlauth_anysafe equivalent to Curlauth_digest | Curlauth_gssnegotiate | Curlauth_ntlmcurlopt_infilesize set the size of the upload file curlopt_low_speed_limit when the transfer speed is less than Curlopt_low_speed_limit, PHP will be based on Curlopt_ Low_speed_time to determine if the transmission is canceled because it is too slow. Curlopt_low_speed_timethe NumbEr of seconds the transfer should is below Curlopt_low_speed_limit for PHP to consider the transfer too slow and abort. When transmitting When the speed is less than Curlopt_low_speed_limit, PHP will determine if it is too slow to cancel the transfer according to Curlopt_low_speed_time. Curlopt_maxconnects the maximum number of connections allowed, exceeding the amount of HTTP redirects that will be determined by curlopt_closepolicy which connections should be stopped curlopt_maxredirs specified, this option is and curlopt _followlocation used together. Curlopt_port An optional curlopt_proxyauththe that specifies the amount of connection port HTTP authentication method (s) to using for the proxy connection. Use the same bitmasks as described in Curlopt_httpauth. For proxy authentication, only Curlauth_basic and CURLAUTH_NTLM is currently supported. Curlopt_proxyportthe port number of the proxy to connect to. This port number can also is set in Curlopt_proxy. Curlopt_proxytypeeither curlproxy_http (default) or CURLPROXY_SOCKS5. Curlopt_resume_from passes a byte offset (used to continue the breakpoint) when the transfer is resumed 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 also verify that it matches the hostname provided. Curlopt_sslVersionthe SSL Version (2 or 3) to use. By default PHP would try to determine the itself, although in some cases this must is set manually. Curlopt_timecondition if edited after a certain time specified by Curlopt_timevalue, use Curl_timecond_ifmodsince to return to the page if it has not been modified and Curlopt_ Header is true, returns a header,curlopt_header of "304 not Modified" to false, using Curl_timecond_isunmodsince, the default value is Curl_timecond_ Ifmodsincecurlopt_timeout set the maximum number of seconds that curl is allowed to perform curlopt_timevalue set a timestamp that is used by the curlopt_timecondition, which is used in the default state Curl_ Timecond_ifmodsincecurlopt_cainfothe name of a file holding one or more certificates to verify the peer with. This is makes sense when used in combination with Curlopt_ssl_verifypeer. Curlopt_capatha directory that holds multiple CA certificates. Use the This option alongside Curlopt_ssl_verifypeer. Curlopt_cookie set the contents of the "Set-cookie:" section of the HTTP request. Curlopt_cookiefile contains the file name of the cookie information, which can be Netscape format or HTTP style header information. Curlopt_cookiejar After the connection is closed, the file name that holds the cookie information Curlopt_customrequesta custom request method to use instead of "GET" or "HEAD" whe NDoing a HTTP request. This was useful for doing "DELETE" or other, and more obscure HTTP requests. Valid values is things like "GET", "POST", "CONNECT" and so on; i.e. do not enter a whole HTTP request line here. For instance, entering ' get/l 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_egbsocketlike curlopt_random_file, except a filename to an Entropy gathering Daemon socket. The content of the "Accept-encoding:" section in Curlopt_encodingheader, supported by the encoding format: "Identity", "deflate", "gzip". If set to an empty string, it means that all encoding formats are supported Curlopt_ftpportthe value which will is used to get the IP address to use for the FTP "POST" instruct Ion. The "POST" instruction tells the remote server to connect to our specified IP address. The string is a plain IP address, a hostname, a network interface name (under Unix), or just a plain '-' to use the SY Stems default IP address. Curlopt_interface the name used in the external network interface, which can be an interface name, IP, or host name. CURLOPT_KRB4LEVELKRB4 (Kerberos 4) Security levelSet, which can be one of several values: "Clear", "safe", "confidential", "private". The default value is "Private", which is set to NULL when KRB4 is disabled, and now KRB4 security can only be used in FTP transport. Curlopt_postfields the "POST" operation in HTTP. If you want to transfer a file, you need a filename at the beginning of the @ curlopt_proxy set through the HTTP proxy server curlopt_proxyuserpwd connected to the proxy server, in the format "[Username]:[password]" User name and password. Curlopt_random_file set the file name of the random number seed used to store SSL Curlopt_range set the HTTP transmission range, you can set a transmission interval in the form of "X-y", if there are multiple HTTP transmissions, use commas to separate multiple values, such as: " X-y,n-m ". Curlopt_referer sets the value of the "Referer:" section in the header. Curlopt_ssl_cipher_lista List of ciphers to use for SSL. For example, Rc4-sha and TLSV1 is valid cipher lists. Curlopt_sslcert passes a string containing a certificate in PEM format. CURLOPT_SSLCERTPASSWD passes a password that contains the required use of the Curlopt_sslcert certificate. Curlopt_sslcerttypethe format of the certificate. Supported formats is "PEM" (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 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 Curlopt_sslkey. Supported key types is "PEM" (default), "DER", and "ENG". Curlopt_url need to get the URL address, can also be set in the PHP Curl_init () function. Curlopt_useragent A string that contains a "user-agent" header in an HTTP request. Curlopt_userpwd passes the user name and password required in a connection in the format: "[Username]:[password]". The curlopt_http200aliases setting no longer handles HTTP 200 responses in the form of an error, in the format of an array. Curlopt_httpheader sets an array of contents to be transferred in a header. Curlopt_postquotean array of FTP commands to execute in 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 sets the location of the output file, the value is a resource type, and the default is stdout (browser). Curlopt_infile the file address to be read when uploading the file, the value is a resource type. Curlopt_stderr sets an error output address, and the value is a resource type that supersedes the default stderr. Curlopt_writeheader sets the file address to write the header portion of the content, and the value is a resource type. Curlopt_headerfunction Setting a callback function, this function has two parameters, the first is the resource handle of curl, and the second is the header data of the output. The output of the header data must rely on this function to return the size of the data that has been written. Curlopt_passwdfunction sets a callback function with three parameters, the first is the resource handle for curl, the second is a password prompt, and the third parameter is the maximum allowable password length. Returns the value of the password. Curlopt_readfunction sets a callback function with two parameters, the first is the resource handle for curl, and the second is the data to be read. Data reads must depend on this function. Returns the size of the read data, such as 0 or EOF. Curlopt_writefunction sets a callback function with two parameters, the first is the resource handle for curl, and the second is the data to be written. Data writes must depend on this function. Returns the exact size of the written data the function of the Curl_copy_handle () function is to copy all the contents and parameters of a curl connection resource $ch = Curl_init (""); $another = Curl_copy_handle ($ch); curl _exec ($another); Curl_close ($another); the function of the Curl_error () function is to return a string containing the current session error information. The function of the Curl_errno () function is to return a numeric number that contains the current session error information. The function of the Curl_multi_init () function is to initialize a curl batching handle resource. The function of the Curl_multi_add_handle () function is to add a separate curl handle resource to the Curl batch session. The Curl_multi_add_handle () function has two parameters, the first parameter represents a curl batch handle resource, and the second parameter represents a separate curl handle resource. The action of the Curl_multi_exec () function is to parse a curl batch handle, the Curl_multi_exec () function has two parameters, the first parameter represents a batch handle resource, the second argument is a reference value parameter, Represents the number of individual curl handle resources remaining to be processed. The Curl_multi_remove_handle () function represents a handle resource removed from the Curl batch handle resource, the Curl_multi_remove_handle () function has two parameters, the first parameter represents a curl batch handle resource, The second parameter represents a separate curl handle resource. The function of the Curl_multi_close () function is to close a batch handleSource. $ch 1 = curl_init (), $ch 2 = Curl_init (), curl_setopt ($ch 1, Curlopt_url, "") curl_setopt ($ch 1, curlopt_header, 0); Curl_ Setopt ($ch 2, Curlopt_url, ""); curl_setopt ($ch 2, Curlopt_header, 0); $mh = Curl_multi_init (); Curl_multi_add_handle ($MH , $ch 1); Curl_multi_add_handle ($MH, $ch 2);d o {curl_multi_exec ($mh, $flag);} while ($flag > 0); curl_multi_remove_ Handle ($MH, $ch 1); Curl_multi_remove_handle ($MH, $ch 2), Curl_multi_close ($MH); Curl_multi_getcontent () The function is to return the text stream of the obtained output in the case of a curlopt_returntransfer set. The purpose of the Curl_multi_info_read () function is to obtain the relevant transmission information for the currently resolved curl. Curl_multi_select () Get all the sockets associated with the CURL extension, which can and be "selected"

PHP CURL curlopt parameter description (curl_setopt)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.