PHP 获取页面内容和保存页面内容

<meta charset="utf-8">  
<?php 
$url = "http://onestopweb.iteye.com/";
//file_get_contents() 把整个文件读入一个字符串中。
$contents = file_get_contents($url);

//对 $contents 进行操作

//file_put_contents() 函数把一个字符串写入文件中。
//该函数将返回写入到文件内数据的字节数。
echo file_put_contents("demo.html",$contents);
?>

效果图:

 

猜你喜欢

转载自onestopweb.iteye.com/blog/2333674
今日推荐