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
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
First Category:For the optional Arguments for option below, value should be set to a value of type bool:OptionsOptional value valueNoteCurlopt_autorefererAutomatically sets the Referer: information in the header when redirected according to location:
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
PHP Curl Common functions
PHP curl is commonly used for: Get,post,http authentication,302 redirection, and setting up the agent for Curl.
1. Turn on PHP's Curl function
Under the Windows platform, or using an integration server such as XAMPP, the
Recently because of the need to call the network disk interface to upload files, I used the CURL library, of course, before using CURL library must be enabled in PHP CURL settings
You can get curl information by using the Php_info () function, and
CURL is a tool that uses URL syntax to transmit files and data. It supports many protocols, such as HTTP, FTP, and TELNET. Many thieves use this function.
CURL is a tool that uses URL syntax to transmit files and data. It supports many protocols,
Curl is a must-have killer for home travel. It's because he's easy to use. It can achieve a series of functions such as page capture simulation login collection.
Remember the first time you touch curl is to achieve the completion from the mailbox
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:
and provide relevant evidence. A staff member will contact you within 5 working days.