解析Cakephp中的HTML [英] Parsing HTML in Cakephp

查看:156
本文介绍了解析Cakephp中的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始在CakePHP 2.2中构建一个web爬虫。
页面,脚本爬行是HTML页面,我需要解析它们以获取我的值。



尝试了一些不同的解决方案,在一些开源的东西,但不知道什么是最好的办法做到这一点。





为了弄清楚,我应该使用哪种方法,我需要你的帮助。

DomDocument是您的最佳选择。在这个模块的php.net文档中有一些体面的例子。如果你可以使用其他语言,比如ruby,那么我对hpricot有很好的体验,像jQuery一样,用于解析html。



这个问题与罗马和成熟的HTML解析器为PHP


I started building a web crawler in CakePHP 2.2. The pages, the script is crawling is HTML pages, and I need to parse them, to get my values.

Have tried some different solutions, and looked on some open source things aswell, but not sure what the best way is to do this.

To figure out, which method I should use, I need your help.

解决方案

DomDocument is your best choice. There are some decent examples in php.net documentation for this module. If you can use other language such as ruby I have very good experience with hpricot, a jQuery like library for parsing html.

This question is related to Robust and Mature HTML Parser for PHP

这篇关于解析Cakephp中的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆