buse974 / simple-page-crawler
ZF3 模块 v0.3.0 - 提供一个获取网页信息的爬虫:标题、元数据、标题标签和图片
0.3.0
2013-01-22 13:19 UTC
Requires
- php: >=5.3.3
- zendframework/zendframework: 2.*
This package is auto-updated.
Last update: 2024-09-16 01:55:34 UTC
README
版本 0.3.0 由 Vincent Blanchon 创建
简介
SimplePageCrawler 是一个网页爬虫。您可以获取以下信息
- 标题
- 元数据(描述、Open Graph 等)
- H1、H2 等
- 图片列表
- 链接列表
使用方法
获取页面信息
$crawler = $this->getServiceLocator('SimplePageCrawler'); $page = $crawler->get('http://www.nytimes.com'); echo sprintf('The title is "%s"', $page->getTitle()); echo sprintf('The description is "%s"', $page->getMeta('description'));
您可以使用动作助手
$page = $this->simplePageCrawler('http://www.nytimes.com'); echo sprintf('The title is "%s"', $page->getTitle()); echo sprintf('The description is "%s"', $page->getMeta('description'));
高级使用
您可以获得 Open Graph 元数据
$page = $this->simplePageCrawler('http://www.nytimes.com'); $metas = $page->getMeta()->getOpenGraph();