Home » PHP24 October 2017

PHP: Scrap Web Page Content using Simple HTML DOM Parser

This article shows how you can scrap or fetch any webpage’s HTML content/data in PHP. We will use Simple HTML DOM Parser to scrap webpage content. You can download it from here: PHP Simple HTML DOM Parser – Sourceforge

You need to download the HTML DOM Parser from sourceforge and include simple_html_dom_parser.php in your PHP file.

Here’s the code to scrap full webpage content:

In the below example, we will scrap a webpage and find data content of a particular div class. We then loop through the div class data and fetch all the “a href” link present in it.

More documentation present here.

Hope this helps. Thanks.

PHP

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed