Web Scraping is a technique used to extract large amounts of data from websites extracted and saved them to a local file in your computer or to a database or can be used as API. Data displayed by most websites can be viewed by using a web browser only. They do not offer the functionality to save a copy of this data for use. Thus the only option is to copy and paste the selected data that is required, which in reality, is a very tedious job and may take hours complete. In other terms, Web Scraping is the technique of automating such a process, in place of manual work, the Web Scraping software performs the same task within seconds.
scrap.php
require_once __DIR__."/simple_html_dom.php";
(You can add this line in plugin main file. In my case plugin main file is pktechnology.in)
<?php
$html = file_get_html('https://pktechnology.co.in/category/laravel/');
$i = 0;
while ($i <= 5) {
$title = $html->find('.blog-entry.post .blog-entry-header .entry-title a', $i)->plaintext;
$url = $html->find('.blog-entry.post .blog-entry-header .entry-title a', $i)->href;
$thumb = $html->find('.blog-entry.post .thumbnail img', $i);
$i++;
?>
<img src="<?php echo $thumb; ?>">
<h1><a href="<?php echo $url; ?>"><?php echo $title; ?></a></h1>
<?php
}
?>