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
Php-curl package [Avoid uploading files ambiguity bug]
Since PHP's curl is in curl_setopt ($curl, curlopt_postfields, xxx), when XXX is an array, if the first character of the value is @, then it is considered a file upload, when you need to upload
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:
PHP//$url = "http://www.baidu.com";$url= "Www.qy.com";$ch= Curl_init ($url); curl_setopt ($ch, Curlopt_header,true);//when enabled, the information for the header file is output as a data stream. curl_setopt ($ch, Curlopt_nobody,true);//when enabled,
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
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 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.