In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article focuses on "how to understand PHP CURL CURLOPT parameters", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to understand PHP CURL CURLOPT parameters.
CURLOPT_RETURNTRANSFER options:
Curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1)
If the result is returned successfully, nothing is automatically output.
Return FALSE if failed
Curl_setopt ($ch, CURLOPT_RETURNTRANSFER,0); or do not use this option:
If only TRUE is returned successfully, the returned content is automatically output.
Return FALSE if failed
Some parameters of the curl_setopt () function of the CURL method in PHP.
Bool curl_setopt (int ch, string option, mixed value)
The curl_setopt () function sets options for a CURL session. The option parameter is the setting you want, and value is the value given by this option.
The values of the following options are used as long shaping (specified in the option parameter):
CURLOPT_INFILESIZE: when you upload a file to a remote site, this option tells PHP the size of the file you uploaded.
CURLOPT_VERBOSE: if you want CURL to report everything unexpected, set this option to a non-zero value.
CURLOPT_HEADER: if you want to include a header in the output, set this option to a non-zero value.
CURLOPT_NOPROGRESS: if you can't PHP to display a process bar for CURL transfer, set this option to a non-zero value. Note: PHP automatically sets this option to a non-zero value, and you should change this option only for debugging purposes.
CURLOPT_NOBODY: if you don't want to include the body section in the output, set this option to a non-zero value.
CURLOPT_FAILONERROR: if you want PHP not to display when an error occurs (HTTP code returns greater than or equal to 300), set this option to an one-person non-zero value. The default behavior is to return a normal page and ignore the code.
CURLOPT_UPLOAD: if you want PHP to prepare for upload, set this option to a non-zero value.
CURLOPT_POST: if you want PHP to be a regular HTTP POST, set this option to a non-zero value. This POST is a normal application/x-www-from-urlencoded type and is mostly used by HTML forms.
CURLOPT_FTPLISTONLY: set this option to a non-zero value, and PHP will list the directory names of FTP.
CURLOPT_FTPAPPEND: set this option to a non-zero value and PHP will apply the remote file instead of overwriting it.
CURLOPT_NETRC: set this option to a non-zero value, and PHP will look up the user name and password of the remote site you want to connect to in your ~. / netrc file.
CURLOPT_FOLLOWLOCATION: set this option to a header with a non-zero value (such as "Location:"), and the server will send it as part of the HTTP header (note that this is recursive, PHP will send a header shaped like "Location:").
CURLOPT_PUT: set this option to a non-zero value to upload a file with HTTP. To upload this file, you must set the CURLOPT_INFILE and CURLOPT_INFILESIZE options.
CURLOPT_MUTE: set this option to a non-zero value and PHP will be completely silent on the CURL function.
CURLOPT_TIMEOUT: sets a number of long shapers, as the maximum duration of seconds.
CURLOPT_LOW_SPEED_LIMIT: sets a long shaping number that controls how many bytes are transferred.
CURLOPT_LOW_SPEED_TIME: sets a long shaping number that controls how many seconds to transfer the number of bytes specified by CURLOPT_LOW_SPEED_LIMIT.
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. The default PHP will be determined by its own efforts, and you have to set it manually for more security.
CURLOPT_TIMECONDITION: pass a long argument that specifies what to do with the CURLOPT_TIMEVALUE parameter. You can set this parameter to TIMECOND_IFMODSINCE or TIMECOND_ISUNMODSINCE. This is for HTTP only.
CURLOPT_TIMEVALUE: pass a number of seconds from 1970-1-1 to the present. This time will be used by the CURLOPT_TIMEVALUE option as the specified value, or by the 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: pass a string in the form of [username]: [password], and use PHP to connect.
CURLOPT_PROXYUSERPWD: pass a string in the form of [username]: [password] to connect to the HTTP proxy.
CURLOPT_RANGE: pass a range that you want to specify. It should be in "Xmury" format, X or Y is excluded. HTTP transmissions also support several intervals, separated by commas.
CURLOPT_POSTFIELDS: a string that passes all the data as a HTTP "POST" operation.
CURLOPT_REFERER: a string containing a "referer" header in the HTTP request.
CURLOPT_USERAGENT: a string containing a "user-agent" header in the HTTP request.
CURLOPT_FTPPORT: pass an IP address that is used by the ftp "POST" instruction. This POST instruction tells the remote server to connect to the IP address we specified. This string can be an IP address, a hostname, a network interface name (under UNIX), or'-'(using the system default IP address).
CURLOPT_COOKIE: pass a header connection that contains HTTP cookie.
CURLOPT_SSLCERT: pass a string containing the certificate in PEM format.
CURLOPT_SSLCERTPASSWD: pass a password that contains the necessary password to use the CURLOPT_SSLCERT certificate.
CURLOPT_COOKIEFILE: a string that passes the name of a file that contains cookie data. The cookie file can be in Netscape format or a HTTP-style header stored in the file.
CURLOPT_CUSTOMREQUEST: when making a HTTP request, passing a character is used by GET or HEAD. For DELETE or other operations is beneficial, more Pass a string to be used instead of GET or HEAD when doing an HTTP request. This is useful for doing or another, more obscure, HTTP request. Note: do not do this before confirming that your server supports 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 and transferred. The default is STDOUT.
CURLOPT_INFILE: this file is the input file you sent over.
CURLOPT_WRITEHEADER: this file contains the header of your output.
CURLOPT_STDERR: this file is written with errors instead of stderr. To get an example of a page that needs to be logged in, the current practice is to log in perhaps once at a time, and make improvements for those in need.
Example 1:
The copy code is as follows:
$cookie_jar = tempnam ('. / tmp','cookie')
$ch = curl_init (); curl_setopt ($ch,CURLOPT_URL, 'http://******');
Curl_setopt ($ch, CURLOPT_POST, 1)
$request = 'email_address=&password=&action='
Curl_setopt ($ch, CURLOPT_POSTFIELDS, $request); / / Save the returned cookie information in the $cookie_jar file
Curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie_jar); / / sets whether the returned data is displayed automatically
Curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); / / sets whether header information is displayed
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 2:
The copy code is as follows:
$ch3 = curl_init ()
Curl_setopt ($ch3, CURLOPT_URL, 'http://*****');
Curl_setopt ($ch3, CURLOPT_HEADER, false)
Curl_setopt ($ch3, CURLOPT_RETURNTRANSFER, 1)
Curl_setopt ($ch3, CURLOPT_COOKIEFILE, $cookie_jar)
$orders = curl_exec ($ch3)
Echo''
Echo strip_tags ($orders)
Echo''
Curl_close ($ch3); proved to be very stable:)
Example 3:
The copy code is as follows:
Set_time_limit (0)
Function _ rand () {
$length=26
$chars = "0123456789abcdefghijklmnopqrstuvwxyz"
$max = strlen ($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="www.baidu.com"; $HTTP_URL="/"; $ch = curl_init(); curl_setopt ($ch,CURLOPT_URL,"http://".$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); print_r($res); 刷论坛代码: 1、抓cookies程序: 复制代码 代码如下: $URL="http://www.yoururl.com/bbs/login.asp?action=chk"; //填入论坛的登陆页面地址 $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$URL); curl_setopt($ch,CURLOPT_REFERER,"http://www.hxfoods.com/bbs/login.asp"); //设置,访问页面的来源地址 curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,'username=→→敢死队→&password=168168'); //分析登陆页面,把用户名,密码分别对应起来 curl_setopt ($ch, CURLOPT_HEADER,true); //使能显示http头, curl_exec($ch); if (curl_errno($ch)) { print curl_error($ch); } else { curl_close($ch); } 2、刷楼了: 复制代码 代码如下: set_time_limit(0); //设置程序执行时间无限制 $i=10000; //耍10000次 for($j=0;$j 'http://www.baidu.com/', 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 set referer information in header
CURLOPT_BINARYTRANSFER
The data will be obtained and returned when CURLOPT_RETURNTRANSFER is enabled
CURLOPT_COOKIESESSION
When enabled, curl passes only one session cookie and ignores other cookie. By default, curl returns all cookie to the server. Session cookie refers to the cookie that is used to determine whether the server-side session is valid or not.
CURLOPT_CRLF
Converts the newline character of Unix to a carriage return newline character when enabled.
CURLOPT_DNS_USE_GLOBAL_CACHE
When enabled, a global DNS cache is enabled, which is thread-safe and defaults to true.
CURLOPT_FAILONERROR
Displays the HTTP status code, and the default behavior is to ignore HTTP information with a number less than or equal to 400
CURLOPT_FILETIME
When enabled, attempts to modify the information in the remote document. The result information is returned through the CURLINFO_FILETIME option of the curl_getinfo () function.
CURLOPT_FOLLOWLOCATION
When enabled, the "Location:" returned by the server server is recursively returned to the server in header, and CURLOPT_MAXREDIRS can be used to limit the number of recursive returns.
CURLOPT_FORBID_REUSE
Forced disconnection after the interaction is completed and cannot be reused.
CURLOPT_FRESH_CONNECT
Forces the acquisition of a new connection, replacing the connection in the cache.
CURLOPT_FTP_USE_EPRT
TRUE 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_EPSV
TRUE to first try an EPSV command for FTP transfers before reverting back to PASV. Set to FALSE to disable EPSV.
CURLOPT_FTPAPPEND
TRUE to append to the remote file instead of overwriting it.
CURLOPT_FTPASCII
An alias of CURLOPT_TRANSFERTEXT. Use that instead.
CURLOPT_FTPLISTONLY
TRUE to only list the names of an FTP directory.
CURLOPT_HEADER
When enabled, the information of the header file is output as a data stream.
CURLOPT_HTTPGET
When enabled, the method of HTTP is set to GET, because GET is the default, so it is only used if it is modified.
CURLOPT_HTTPPROXYTUNNEL
When enabled, it is transmitted through the HTTP proxy.
CURLOPT_MUTE
It is said that all modified parameters in the curl function are restored to their default values.
CURLOPT_NETRC
After the connection is established, access the ~ / .netrc file to get user name and password information to connect to the remote site.
CURLOPT_NOBODY
When enabled, the body portion of the HTML is not output.
CURLOPT_NOPROGRESS
Turn off the progress bar for curl transfer when enabled. The default setting for this item is true
CURLOPT_NOSIGNAL
Ignore all signals that curl sends to php when enabled. This is turned on by default in SAPI multithreaded transfers.
CURLOPT_POST
When enabled, a regular POST request of type: application/x-www-form-urlencoded is sent, just like the form submitted.
CURLOPT_PUT
Allow HTTP to send files when enabled, CURLOPT_INFILE and CURLOPT_INFILESIZE must be set at the same time
CURLOPT_RETURNTRANSFER
The information obtained by curl_exec () is returned in the form of a file stream rather than output directly.
CURLOPT_SSL_VERIFYPEER
FALSE to stop cURL from verifying the peer's certificate. 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 also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2). TRUE by default as of cURL 7.10. Default bundle installed as of cURL 7.10.
CURLOPT_TRANSFERTEXT
TRUE 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
User name and password information is continuously appended to multiple locations in the header generated by using CURLOPT_FOLLOWLOCATION, even if the domain name has changed.
CURLOPT_UPLOAD
Allow file transfer when enabled
CURLOPT_VERBOSE
When enabled, all information will be reported and stored in STDERR or specified CURLOPT_STDERR.
CURLOPT_BUFFERSIZE
Each time the size of the cache is read into the fetched data, this value is filled every time.
CURLOPT_CLOSEPOLICY
Either CURLCLOSEPOLICY_LEAST_RECENTLY_USED or CURLCLOSEPOLICY_OLDEST, there are three more, but curl doesn't support it yet. .
CURLOPT_CONNECTTIMEOUT
The time to wait before initiating a connection, if set to 0, does not wait.
CURLOPT_DNS_CACHE_TIMEOUT
Sets the time for keeping DNS information in memory, default to 120 seconds.
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
Set the HTTP protocol used by curl, CURL_HTTP_VERSION_NONE (let curl judge), CURL_HTTP_VERSION_1_0 (HTTP/1.0), CURL_HTTP_VERSION_1_1 (HTTP/1.1)
CURLOPT_HTTPAUTH
The HTTP verification method is used. 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 asks the server to select a value that supports the best. CURLAUTH_ANY is equivalent to CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM,CURLAUTH_ANYSAFE is equivalent to CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM
CURLOPT_INFILESIZE
Set the size of the uploaded file
CURLOPT_LOW_SPEED_LIMIT
When the transmission speed is less than CURLOPT_LOW_SPEED_LIMIT, PHP will determine whether the transmission is canceled because it is too slow according to the 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.
When the transmission speed is less than CURLOPT_LOW_SPEED_LIMIT, PHP will determine whether the transmission is canceled because it is too slow according to the CURLOPT_LOW_SPEED_TIME.
CURLOPT_MAXCONNECTS
The maximum number of connections allowed will be decided by the CURLOPT_CLOSEPOLICY which connections should be stopped
CURLOPT_MAXREDIRS
Specifies the maximum number of HTTP redirects, which is used with CURLOPT_FOLLOWLOCATION.
CURLOPT_PORT
An optional amount used to specify the connection 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
Pass a byte offset when resuming transmission (used for breakpoint continuation)
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
If it has been edited after a certain time specified by CURLOPT_TIMEVALUE, use CURL_TIMECOND_IFMODSINCE to return the page. If it has not been modified and the CURLOPT_HEADER is true, a header,CURLOPT_HEADER of "304Not Modified" is returned as false, then CURL_TIMECOND_ISUNMODSINCE is used. The default value is CURL_TIMECOND_IFMODSINCE.
CURLOPT_TIMEOUT
Set the maximum number of seconds allowed for curl execution
CURLOPT_TIMEVALUE
Set a timestamp used by CURLOPT_TIMECONDITION, using CURL_TIMECOND_IFMODSINCE by default
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
Set the contents of the "Set-Cookie:" section of the HTTP request.
CURLOPT_COOKIEFILE
The name of the file that contains cookie information. The cookie file can be in Netscape format or HTTP-style header information.
CURLOPT_COOKIEJAR
After the connection is closed, the name of the file where the cookie information is stored
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\ 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
The contents of the "Accept-Encoding:" section of header. The supported encoding formats are "identity", "deflate", "gzip". If set to an empty string, all encoding formats are supported
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
The name used in the external network interface can be an interface name, IP, or hostname.
CURLOPT_KRB4LEVEL
The KRB4 (Kerberos 4) security level setting can be one of the following values: "clear", "safe", "confidential", "private". The default value is "private". Setting it to null means that KRB4 is disabled, and now KRB4 security can only be used in FTP transmissions.
CURLOPT_POSTFIELDS
The "POST" operation in HTTP. If you want to transfer a file, you need a file name that starts with @
CURLOPT_PROXY
Set the passed HTTP proxy server
CURLOPT_PROXYUSERPWD
Username and password connected to the proxy server in the format "[username]: [password]".
CURLOPT_RANDOM_FILE
Set the name of the file that stores the random number seeds used by SSL
CURLOPT_RANGE
To set the HTTP transmission range, you can set a transmission interval in the form of "Xmury Y". If there are multiple HTTP transmissions, use commas to separate multiple values, such as "Xmury YPM Nmurm".
CURLOPT_REFERER
Set the value of the "Referer:" section of the header.
CURLOPT_SSL_CIPHER_LIST
A list of ciphers to use for SSL. For example, RC4-SHA and TLSv1 are valid cipher lists.
CURLOPT_SSLCERT
Pass a string containing the certificate in PEM format.
CURLOPT_SSLCERTPASSWD
Pass a password that contains the necessary password to use the CURLOPT_SSLCERT certificate.
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
The URL address to be obtained can also be set in the curl_init () function of PHP.
CURLOPT_USERAGENT
Contains a string with the header "user-agent" in the HTTP request.
CURLOPT_USERPWD
Pass the user name and password required in a connection in the format "[username]: [password]".
CURLOPT_HTTP200ALIASES
The response to HTTP 200s is no longer processed as error, but in an array format.
CURLOPT_HTTPHEADER
Sets an array of content transferred in header.
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
Sets the location of the output file, the value is a resource type, and the default is STDOUT (browser).
CURLOPT_INFILE
The address of the file that needs to be read when uploading the file, and the value is a resource type.
CURLOPT_STDERR
Set an error output address and the value is a resource type instead of the default STDERR.
CURLOPT_WRITEHEADER
Sets the file address to which the contents of the header section are written, and the value is a resource type.
CURLOPT_HEADERFUNCTION
Set up a callback function that takes two parameters, the first is the curl's resource handle, and the second is the output header data. The output of header data must rely on this function to return the size of the data that has been written.
CURLOPT_PASSWDFUNCTION
Set a callback function with three parameters, the first is the curl's resource handle, the second is a password prompt, and the third parameter is the maximum password length allowed. Returns the value of the password.
CURLOPT_READFUNCTION
Set a callback function with two parameters, the first is the resource handle of curl, and the second is the read data. Data reading must depend on this function. Returns the size of the read data, such as 0 or EOF.
CURLOPT_WRITEFUNCTION
Set a callback function with two parameters, the first is the resource handle of curl, and the second is the written data. Data writing must depend on this function. Returns the exact size of the written data
The function curl_copy_handle () copies all the contents and parameters of a curl connection resource
$ch = curl_init ("http://www.baidu.com/");
$another = curl_copy_handle ($ch)
Curl_exec ($another)
Curl_close ($another)
The curl_error () function returns a string containing the current session error message.
The curl_errno () function returns a numeric number containing the current session error message.
The curl_multi_init () function initializes a curl batch handle resource.
The curl_multi_add_handle () function adds a separate curl handle resource to the curl batch session. The curl_multi_add_handle () function takes two parameters, the first of which represents a curl batch handle resource and the second of which represents a separate curl handle resource.
The curl_multi_exec () function parses a curl batch handle, and the curl_multi_exec () function takes two arguments, the first parameter represents a batch handle resource, and the second parameter is a reference parameter that represents the remaining number of individual curl handle resources that need to be processed.
The curl_multi_remove_handle () function represents the removal of a handle resource from a curl batch handle resource, and the curl_multi_remove_handle () function takes two parameters, the first of which represents a curl batch handle resource, and the second parameter represents a separate curl handle resource.
The curl_multi_close () function closes a batch handle resource.
$ch2 = curl_init ()
$ch3 = curl_init ()
Curl_setopt ($ch2, CURLOPT_URL, "http://www.baidu.com/");"
Curl_setopt ($ch2, CURLOPT_HEADER, 0)
Curl_setopt ($ch3, CURLOPT_URL, "http://www.google.com/");"
Curl_setopt ($ch3, CURLOPT_HEADER, 0)
$mh = curl_multi_init ()
Curl_multi_add_handle ($mh,$ch2)
Curl_multi_add_handle ($mh,$ch3)
Do {
Curl_multi_exec ($mh,$flag)
} while ($flag > 0)
Curl_multi_remove_handle ($mh,$ch2)
Curl_multi_remove_handle ($mh,$ch3)
Curl_multi_close ($mh)
The curl_multi_getcontent () function returns the text stream of the obtained output when CURLOPT_RETURNTRANSFER is set.
The purpose of the curl_multi_info_read () function is to get the transmission information about the currently parsed curl.
Curl_multi_select ()
Get all the sockets associated with the cURL extension, which can then be "selected"
At this point, I believe you have a deeper understanding of "how to understand PHP CURL CURLOPT parameters". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.