Use of simple_html_dom.php

Source: Internet
Author: User
Simple_html_dom.php's use of simple_html_dom.php can be said to use PHP to process web pages, html can also be.

However, unlike java for processing different webpage codes, different codes are not processed and have been improved. The following describes how to use them:
(Note: Currently, only UTF8 or gb2312 web pages are read .)

In g/fw. php, the following definition is related to simple_html_dom:

$ MY_HTML_CONV = "utf8-> gb"; // This is the setting for reading UTF8 encoding.

$ IS_CURL = true; // use curl to read the webpage or use file_get_contents to read the webpage.

$ IS_CONV = true; // whether to use iconv () or mb_convert_encoding for transcoding <-- This is irrelevant to simple_html_dom

---------------------------------------------------------------------------------

Note: If you want to read the gb2312 encoding in a function, and you have specified in $ MY_HTML_CONV to read the UTF8 encoding, use the following:

Include ('simplehtmldom/simple_html_dom.php ');

// Read the content of the GB2312 webpage.
$ GLOBALS ['My _ HTML_CONV '] = null; // Note: This line is used to modify the value defined in g/fw. php.
$ Html = str_get_html ($ ct );

---------------------------------------------------------------------------------

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.