phpQuery-分析网页文本的新利器

phpQuery是一个服务器端jQuery开源项目。它可以让PHP开发人员采用与jQuery相同的语法来处理网页元素。
在这以前要抓取分析网页文本,不会写正则几乎不可能实现,现在好了,有了phpQuery.
phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library.

Library is written in PHP5 and provides additional Command Line Interface (CLI).

如果你使用过jQuery,你会发现操作网页文本dom如此简单。

  < ?php     
  include_once( './phpQuery.php' );     
  $html = new phpQueryDocumentFile('xxx.html');  
  $title = $html->find('title')->text();     
  echo $title;

以上内容是取得网页的 title。多方便啊。。。
更多信息..
http://code.google.com/p/phpquery/

 

Comments

No comments so far.
  • Leave a Reply
     
    Your gravatar
    Your Name
     
     
     
     
     
 
About This Website

Lamp development & SEO & Plan of Website & Project Managment

Learn more »
Follow Us (SNS)
Help & Support

more about Bruce.xu»

Get in touch

QQ: +252339382
Email: shjuto @ gmail.com

Online contact form »