[PHP]
Class Curl {
/*
* Get method get access to specified address
* @param the address to be accessed by the string URL
* @param the storage address of a string cookie cookie, no cookie is sent
* @return string curl_exec () gets the information
*
PHP curl can be used to crawl Web pages, analysis of Web data use, simple and easy-to-use, here to introduce its functions, such as not detailed description, put the code to see:
Only a few of the main functions are retained. To implement a mock
First, write a simple crawl page function
Copy Code code as follows:
function Getsources ($URL, $User _agent= ', $Referer _url= ')//crawl a specified page
{
$URL page address that needs to be crawled
$User _agent need to return
Demo Code
Operation effect (Figure 1)
Operation effect (Figure 2)
Main Package function
Multi_process ();According to the parameters, create the number of pointers to the child process.Bright spot Function 1: The
curl_setopt--Sets an option for the curl callDescribe BOOL curl_setopt (INT-ch, string option, mixed value) The curl_setopt () function sets the option for a curl session. The option parameter is the setting you want, and value is the values
Using curl, you can quickly crawl Web pages, simulate post, get requests, and not just some of the HTTP protocol packages, but also support FTP, proxy, HTTPS, LDAP and other applications.
Curl is not unique to PHP, many languages have, a thing to
Description: Use curl to quickly crawl Web pages, simulate post, get requests, of course, not only some of the HTTP protocol encapsulation, but also support FTP, proxy, HTTPS, LDAP and other applications. Curl is not unique to PHP, many languages
The Curl command is a file transfer tool that works under the command line using URL rules.Curl supports file uploads and downloads, so it is a comprehensive transfer tool, but traditionally, it is customary to call curl as a download tool.As a
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.