PHP curl function simulation browser grabs web site information
the original PHP does not extend this function by default, but it still exists, but it has not been put into effect. Open the PHP installation directory, search the following three files ssleay32.dll, libeay32.dll and php_curl.dll, copy to the system32 folder under the system directory, modify the php.ini file, find; extension= php_curl.dll line, remove the front; number, save, restart the service. Set up a PHP file in the site directory, with the following
PHP code
.lt; PHP
$ch = curl_init (.Quot; http://www.php.net.quot;); The installation is successful.
the installation of Linux and UNIX can be a bit cumbersome. You have to download the curl library
____________________________________________________________
on http://curl.haxx.se/ or other websites. The Lue)
curl_setopt () function will set options for a CURL session. The option parameter is the setting you want, and value is the given value of this option. The values of the following options will be used as long plastic use (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 upload.
*CURLOPT_VERBOSE: if you want CURL to report every unexpected event, 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 do not PHP to display a process bar for CURL transmission, set this option to be a non zero value. Note: PHP automatically sets this option to non zero value. You should change this option just for debugging purposes.
*CURLOPT_NOBODY: if you do not want to include the body part in the output, set this option to be a non zero value.
*CURLOPT_FAILONERROR: if you want PHP to make a mistake (the HTTP code returns more than 300), it does not display, setting this option for one person non zero value. The default behavior is to return to a normal page, ignoring the code.
*CURLOPT_UPLOAD: if you want PHP to prepare for uploading, set this option to be a non zero value.
*CURLOPT_POST: if you want PHP to do a regular HTTP POST, set this option to a non zero value. This POST is an ordinary application/x-www-from-urlencoded type, most of which are used by HTML forms.
*CURLOPT_FTPLISTONLY: sets this option to a non zero value, and PHP lists the directory name list of FTP.
*CURLOPT_FTPAPPEND: sets this option to a non zero value, and PHP applies remote files instead of overwriting them.
*CURLOPT_NETRC: sets this option for a non - zero value, and PHP will find the username and password of the remote site you want to connect to in your ~./netrc file.
*CURLOPT_FOLLOWLOCATION: sets this option as the head of a non - zero value (like "Location:"), and the server sends it as part of the HTTP header (note that this is recursive, and PHP will be sent like the head of "Location:").
*CURLOPT_PUT: sets this option to upload a file to a non zero value to HTTP. To upload this file, you have to set the CURLOPT_INFILE and CURLOPT_INFILESIZE options. *CURLOPT_MUTE: sets this option for a non zero value, and PHP will be completely silent for the CURL function.
*CURLOPT_TIMEOUT: sets a long integer number as the maximum duration.
*CURLOPT_LOW_SPEED_LIMIT: sets a long shaping number to control how many bytes are transmitted.
*CURLOPT_LOW_SPEED_TIME: sets a long integer to control how many seconds the number of bytes specified by CURLOPT_LOW_SPEED_LIMIT is transmitted.
*CURLOPT_RESUME_FROM: passes a long shaping parameter that contains byte offset addresses (the initial form you want to transfer to).
*CURLOPT_SSLVERSION: passes a long parameter that contains the SSL version. The default PHP will be determined by its own efforts. In more security, you have to manually set it up.
*CURLOPT_TIMECONDITION: passes a long parameter specifying how to handle CURLOPT_TIMEVALUE parameters. You can set this parameter to TIMECOND_IFMODSINCE or TIMECOND_ISUNMODSINCE. This is only for HTTP.
*CURLOPT_TIMEVALUE: passes the number of seconds from the beginning of 1970-1-1 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:, which 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: passes a form string like [username]: [password] style, which acts PHP to connect.
*CURLOPT_PROXYUSERPWD: passes a string that looks like [username]: [password] format to connect HTTP agent.
*CURLOPT_RANGE: passes a range you want to specify. It should be "X-Y" format, except X or Y. HTTP transport also supports several intervals, and uses a sentence to separate (X-Y, N-M).
*CURLOPT_POSTFIELDS: passes a string of all data as the HTTP "POST" operation.
*CURLOPT_REFERER: contains a string of "referer" header in the HTTP request.
*CURLOPT_USERAGENT: contains a string of "user-agent" header in the HTTP request.
*CURLOPT_FTPPORT: passes a IP address that contains the FTP "POST" directive. This POST directive 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: passes a header connection that contains HTTP cookie.
*CURLOPT_SSLCERT: passes a string containing the PEM format certificate.
*CURLOPT_SSLCERTPASSWD: passes a password that contains the CURLOPT_SSLCERT certificate.
*CURLOPT_COOKIEFILE: passes a string that contains the name of a file containing cookie data. The cookie file can be in Netscape format, or the HTTP style header in the heap file.
*CURLOPT_CUSTOMREQUEST: when a HTTP request is made, a character is passed to be used by GET or HEAD. DELETE or other operations are beneficial, Pass a string to be used instead of GET or HEAD. The following option requires a file description (obtained by using the fopen () function): the
*CURLOPT_FILE: file will be the output file you put in the transfer, the default is that the STDOUT.
*CURLOPT_INFILE: file is the input file you sent.
*CURLOPT_WRITEHEADER: this file writes the header part of your output. The
*CURLOPT_STDERR: file is written with errors instead of stderr. An example of getting a page that needs to be logged in is that it may be logged in at any time, and those who need it can be improved again: