Copy the code The code is as follows:
// Initialization
$curl = curl_init();
// The URL to be visited
curl_setopt($curl, CURLOPT_URL, 'http://asen.me/') ;
// Set the source
curl_setopt($curl, CURLOPT_REFERER, 'http://google.com/');
// Do not enter the content directly
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// Drop the result Save in $result
$result = curl_exec($curl);
// Close
curl_close($curl);
The above introduces michael jackson you are not al's use of CURL forged origins to crawl pages or files in PHP, including the content of michael jackson you are not al. I hope it will be helpful to friends who are interested in PHP tutorials.