DEV Community

Cover image for Scrape all images using dom parser php
pikasho
pikasho

Posted on

Scrape all images using dom parser php

Here you scrape all images from Top Follow website using HTML Dom parser.

Here is php code and try with it

include("simple_html_dom.php");

$link = "https://topfollow.org";


    $html = file_get_html($link);


    $images_array = array();

    foreach ($html->find('table.infobox vcard td, img') as $element) {
        $allimages = strtok($element->src . '|', '|');
        array_push($images_array, $allimages);
    }
print_r($images_array);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)