新闻采集,是目前行业的通用做法。
下面以php为例,介绍一下采集的实现。
<?php
function newsList(){
$url=’http://pub.jian.gov.cn/jxyf/bmgkxx/xzfb/index_5.htm';
$output=file_get_contents($url);
// echo $output;
$reg=’//‘;
// /Uis
echo ‘REG-‘.$reg;
preg_match_all($reg,$output,$mat);
print_r($mat);
}
function newsDetail(){
$url=’http://pub.jian.gov.cn/jxyf/bmgkxx/xzfb/gzdt/zwdt/201801/t20180118_10050210.htm';
$output=file_get_contents($url);
echo $output;
$reg=’/
echo ‘REG-‘.$reg;
preg_match($reg,$output,$mat);
print_r($mat);
}
newsDetail();
?>
newsList 方法采集了列表
newsDetail采集了内容