for ($start = 0; $start < 250; $start += 25) { $url = "http://www.51sjk.com/Upload/Articles/1/0/324/324197_20220824103253727.jpg $titles = parsePage($url); if ($titles === false) { echo $url, "\n"; } else { array_walk($titles, 'printTitle'); } } function parsePage($url) { $html = file_get_contents($url); if ($html === false) { return false; } if (preg_match_all('/<a.+?<span class="title">([^<]+)/s', $html, $matches) === false) { return false; } $titles = array(); foreach($matches[1] as $item) { $titles[] = iconv('utf-8', 'gbk', $item); } return $titles; } $count = 0; function printTitle($title) { global $count; ++$count; printf("%3d %s\n", $count, $title); }
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....