<?php

header("content-type:text/html;charset=gbk");

// 要采集的页面的地址

$url = "http://www.2cloo.com/hot";

// 获取页面内容

$url_content = file_get_contents( $url );

// 将页面内容保存在本地

file_put_contents('caiji.html', $url_content);

// 从本地的获取内容

$content = file_get_contents( 'caiji.html' );

// 确定要匹配内容的正则

$preg_content = '|<strong>(.*?)</strong>|i';

// 正则匹配 获取到需要的内容

preg_match_all($preg_content, $url_content, $data);

print_r( $data );

?>

相关文章:

  • 2021-10-18
  • 2022-12-23
  • 2021-11-26
  • 2021-12-10
  • 2022-01-07
  • 2021-05-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-12-10
  • 2021-12-10
  • 2021-05-20
相关资源
相似解决方案