龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php使用file_get_contents函数抓取页面信息

时间:2014-07-16 15:07来源:网络整理 作者:网络 点击:
分享到:
php使用file_get_contents函数抓取页面信息 [代码片段(6行)]
$url="http://outofmemory.cn
$contents=@file_get_contents($url);
//preg_match_all("/<p class=\\"right forumcount\\">(.*?)<\\/p>/is",$contents,$content);
preg_match_all("/<h3>(.*?)<\\/h3>/is",$contents,$content);
print_r($content[0]);
//该片段来自于http://outofmemory.cn
精彩图集

赞助商链接