php代码|读取指定网页无限生成html文件-组合第二步(php读取网页内容)
时间:2021-03-18 00:18:57 阅读:849
PHP
<?php
$urls="http://www.chfkw.cc/sly";//定义要采集的路径
$fo=fopen($urls,"r");//以只读方式打开url
$content=@file_get_contents($urls);//通过url获取内容
echo $content;//打印对应网站内容
//eregi("<title>(.*)</title>",$content,$titles);//用正则表达式读取网站title标签内容
print_r($content);//打印数组title
//$tijiao = $_POST['tijiao'];
$fc = file_get_contents("xw.txt");
$fff = fopen("xw.txt", "w");
$count =$fc+1;
$paths="htm/xw".$count.".html";//定义要生成的html路径
$handles=fopen($paths,"w");//以可写方式打开路径
fwrite($handles,$content);//写入内容
fclose($handles);//关闭打开的文件
$fd = fwrite($fff,$count);
fclose($fff);
?>
懂得都懂
网友评论