Home  >  Article  >  Backend Development  >  PHP simulation browser CURL collection Alibaba_PHP tutorial

PHP simulation browser CURL collection Alibaba_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:43:231409browse

It is said that Alibaba has the myth that it cannot collect and prevent collection. Today, I wrote a code to simulate a browser using the Curl collection taught by Teacher Zhang. Nothing is impossible unless you don’t do it, haha

set_time_limit(0);

function _rand() {

$length=26;

$chars = "0123456789abcdefghijklmnopqrstuvwxyz";

$max = strlen($chars) - 1;

mt_srand((double)microtime() * 1000000);

$string = ;

for($i = 0; $i < $length; $i++) {

$string .= $chars[mt_rand(0, $max)];

}

return $string;

}

$HTTP_SESSION=_rand();

$HTTP_SESSION;

$HTTP_Server="search.china.alibaba.com";

$HTTP_URL="/company/k-%CB%AE%CB%AE%CB%AE_n-y.html";

$ch = curl_init();

curl_setopt ($ch,CURLOPT_URL,"http://".$HTTP_Server.$HTTP_URL);

curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)");

$res = curl_exec($ch);

curl_close ($ch);

print_r($res);

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478837.htmlTechArticleIt is said that Alibaba has myths about being unable to collect and preventing collection. Today I will write it using the Curl collection taught by Teacher Zhang. A code that emulates a browser. Nothing is impossible except don’t do it, haha ​​?php se...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn