<?php
$url = "http://mi.techweb.com.cn/";
$header = array('User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/33.0.1750.146 Safari/537.36');
//$headerArray =array("Content-type:application/json;","Accept:application/json");
//开启curl
$ch = curl_init();
//配饰
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
// 执行
$output = curl_exec($ch);
// var_dump($output);
// $reg = '/<a href="(.*)">(.*)<\/a>/U';
$reg = '/<div class="(.*)">(.*)<\/div>/U';
$arr = preg_match_all($reg,$output,$data);
print_r($data);
// curl_close($ch);
PHP 爬虫处理
于 2022-06-23 14:34:07 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)