A php-implemented HTML parser class can be used to collect data.
Source: Internet
Author: User
The following is the HTML parsing class and usage. the following function is to collect Baidu data from www.opendir.cn. you can test the function if you need it.
The code is as follows:
$ OldSetting = libxml_use_internal_errors (true );
Libxml_clear_errors ();
/**
*
*-+ -----------------------------------
* | PHP5 Framework-2011
* | Web Site: www. iblue. cc
* | E-mail: mejinke@gmail.com
* | Date: 2012-10-12
*-+ -----------------------------------
*
* @ Desc HTML parser
* @ Author jingke
*/
Class XF_HtmlDom
{
Private $ _ xpath = null;
Private $ _ nodePath = '';
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.