php file_get_contents抓取页面信息的代码
php file_get_contents函数抓取页面信息,详见文中的例子。
<?php
/**
@抓取页面信息
@file_get_contents函数应用
@site www.jquerycn.cn
*/
$url="http://www.jquerycn.cn/article/518.html";
$contents=@file_get_contents($url);
preg_match_all("/<h1>(.*?)<\/h1>/is",$contents,$content);
//测试,打印结果
print_r($content[0]);
?>
您可能感兴趣的文章:
php file_get_contents抓取页面信息的代码
php file_get_contents函数抓取页面信息的代码
PHP 抓取内容中图片并下载保存的代码
PHP读写文件生成HTML的代码举例
php读取远程文件的三种方法分享
php file_get_contents函数的使用问题
php中curl、fsocket、file_get_content函数比较
php file_get_contents 设置代理抓取页面示例
PHP fopen/file_get_contents与curl性能比较
php 获取远程网页内容简单函数