Php_curl use of the detailed

Source: Internet
Author: User
Keywords Php_curl use of the detailed
Tags http post
Curl is a routing file tool that uses URL syntax to support FTP, FTPS, HTTP htpps SCP SFTP TFTP, TELNET DICT file, and LDAP. Curl supports SSL certificates, HTTP POST, http PUT, FTP uploads, Kerberos, HTT-based uploads, proxies, cookies, user + password proofs, file transfer recovery, HTTP proxy channels, and a number of other useful tricks. See the reference manual

It turns out that PHP does not extend this functionality by default, but it does, but it does not make it effective. Open the PHP installation directory, search the following three files Ssleay32.dll, Libeay32.dll and Php_curl.dll, one by one copy to the system directory under the System32 folder, modify the php.ini file, find; extension= php_ Curl.dll line, remove the previous; number, save, restart the server. Create a PHP file in the site directory as follows:

$ch = Curl_init (―http://www.php.cn‖);

Curl_exec ($ch);

Curl_close ($ch);

Preview If you can open http://www.php.cn, the installation is successful.

Linux and Unix installations can be cumbersome, and you'll need to download the Curl Library from http://curl.haxx.se/or other websites

____________________________________________________________

The following is an argument about this function's use:

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 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 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:") header, the server will send it as part of the HTTP header (note that this is recursive, PHP will be sent as "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.

  • 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.