PHP4 User Manual: Function -> CURL-> CURL

zhaozj2021-02-08  197

CURL_SETOPT

(PHP 4> = 4.0.2) CURL_SETOPT - Set an option for the CURL call

description

Bool CURL_SETOPT (Int Ch, String Option, Mixed Value)

The curl_setopt () function will be a CURL session setting option. The Option parameter is the settings you want, and Value is the value given by this option.

The value of the following options will be used as a long shape (specified in the Option parameter):

CURLOPT_INFILESIZE: When you upload a file to the remote site, this option tells PHP you upload the file size. CURLOPT_VERBOSE: If you want curl to report every unexpected thing, set this option as a non-zero value. CURLOPT_HEADER: If you want to include a header in the output, set this option as a non-zero value. CURLOPT_NOPROGRESS: If you don't PHP to transfer to the curl to display a process strip, set this option as a non-zero value.

Note: PHP automatically sets this option for non-zero, you should only change this option just for the purpose of debugging.

CURLOPT_NOBODY: If you don't want to include a Body section in the output, set this option as a non-zero value. CURLOPT_FAILONERROR: If you want PHP when an error occurs (HTTP code is returned to equal to 300), the setting is not displayed for a 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 as a non-zero value. CURLOPT_POST: If you want PHP to do a regular HTTP POST, set this option as a non-zero value. This POST is a normal Application / X-www-from-urlencoded type, mostly used by the HTML form. CURLOPT_FTPLISTONLY: Set this option to a non-zero value, PHP will list the list of FTPs. CURLOPT_FTPAPPEND: Setting this option as a non-zero value, PHP will apply remote file instead of overwriting it. CURLOPT_NETRC: Setting this option to a non-zero value, PHP will look for the username and password you want to establish a connection to the remote site in your ~. / NETRC file. CURLOPT_FOLLOWPATION: Set this option to a non-zero value (like "location:"), the server will send it as part of the HTTP header (Note that this is recursive, the PHP will send the message, such as "Location:".). CURLOPT_PUT: Set this option to upload a file with HTTP with a non-zero value. To upload this file, you must set the curlopt_infile and curlopt_infilesize option. CURLOPT_MUTE: Set this option as a non-zero value, PHP will be completely silent for the curl function. CURLOPT_TIMEOUT: Sets a long shape as a maximum continuation. CURLOPT_LOW_SPEED_LIMIT: Sets a long shape, and how many bytes are controlled. CURLOPT_LOW_SPEED_TIME: Set a long shape, control how many seconds to transmit curlopt_low_speed_limit specified by the number of bytes. CURLOPT_RESUME_FROM: Pass a long shape parameter containing byte offset addresses, (you want to transfer the start form). CURLOPT_SSLVERSION: Pass a long parameter containing the SSL version. The default PHP will be determined by its own efforts, in more security you must manually set. CURLOPT_TIMECONDITION: Pass a long parameter, specify how to process the curlopt_timevalue parameter. You can set this parameter for timecond_ifmodsince or timecond_isunmodsince. This is only used for http. CURLOPT_TIMEVALUE: Pass a number of seconds from 1970-1-1 to now. This time will be used as the specified value by the curlopt_timevalue option, or is used by the default timecond_ifmodsince. The value of the following options will be as a string:

CURLOPT_URL: This is the URL address you want to retrieve with PHP. You can also set this option when you use the curl_init () function to initialize. CURLOPT_USERPWD: Pass a string of [username]: [Password] style, PHP is connected. CURLOPT_PROXYUSERPWD: Pass a string to connect to the HTTP agent in a string of the [username]: [Password] format. CURLOPT_RANGE: Pass a range you want to specify. It should be "x-y" format, X or Y is except. HTTP transmission also supports several intervals, separating (x-y, n-m) with a community. CURLOPT_POSTFIELDS: Pass a string of all data as an HTTP "POST" action. CURLOPT_REFERER: Contains a string of the "Referr" header in the HTTP request. CURLOPT_USERAGENT: Contains a string of the "User-Agent" header in the HTTP request. CURLOPT_FTPPORT: Pass an IP address that contains 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 host name, a network interface name (under UNIX), or '-' (using the system default IP address). CURLOPT_COOKIE: Pass a header that contains HTTP cookie. CURLOPT_SSLCERT: Pass a string containing the PEM format certificate. CURLOPT_SSLCERTPASSWD: Pass a password that contains the required use of the CURLOPT_SSLCERT certificate. CURLOPT_COOKIEFILE: Pass strings of the name of the file containing the cookie data. This cookie file can be a Netscape format or a heap of the HTTP style in the file. CURLOPT_CUSTOMREQUEST: When the HTTP request is performed, it is used to use a character to be used by GET or HEAD. To make DELETE or other operations, it is beneficial, more PASS A STRING TO BE Used INSTETP Request. This is useful for doing or noother, more obscure, http request. Note: Confirm your server support Don't do this first.

The following options require a file description (obtained by using the fopen () function):

CURLOPT_FILE: This file will be the output file you place, the default is stdout. Curlopt_infile: This file is the input file you passed. CURLOPT_WRITEHEADER: This file writes some header of you. CURLOPT_STDERR: This file has an error instead of stderr.

转载请注明原文地址:https://www.9cbs.com/read-3442.html

New Post(0)