Jquery中文网 www.jquerycn.cn
Jquery中文网 >  脚本编程  >  php  >  正文 php file_get_contents抓取页面信息的代码

php file_get_contents抓取页面信息的代码

发布时间:2015-09-18   编辑:www.jquerycn.cn
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 获取远程网页内容简单函数

关键词: 数据抓取  网站数据抓取  抓取   
[关闭]