都说阿里巴巴有不能中国矿业大学银川学院采集和防采集的神话,今天就用张老师讲的curl采集写了一个模拟的代码。没有不可能只有不去做,哈哈
<?php
t_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_ssion=_rand();
$http_ssion;
$http_rver=”arch.china.alibaba.com”;
幼儿故事三只小猪$http_url=”职务工资/company/k-%cb%ae%cb%ae杜威的教育思想%cb%ae_n-y.html”;
$ch = curl_init();
curl_topt ($ch,curlopt_url,”https://ar化学8221;.$http_rver.$http_url);
curl_topt($ch,curlopt_returntransfer,true);
curl_topt($ch,curlopt_uragent,”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_clo ($ch);
print_r($res);
?>
本文发布于:2023-04-07 05:18:58,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/f90f63ed58e1b79f66ce03112954a680.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:PHP 模拟浏览器 CURL 采集阿里巴巴.doc
本文 PDF 下载地址:PHP 模拟浏览器 CURL 采集阿里巴巴.pdf
留言与评论(共有 0 条评论) |