Skip to content

How to scrap image from Magento script type=”text/x-magento-init”

I’m using simple_html_dom.php function to scrap data to specific Magento site. I am able to scrap all of the things but can’t able to find additional images which are comes from script type=”text/x-magento-init” I tried all the way but can’t able to fetch. Here are some sample code which I tried. Is it possible to scrap data from scrip tag which are available image in it?

> $scripts = $html->find('script',19);
>     forforeach ($scripts->find("<tag>") as $<tag>) 
>     {
>         foreach ($<tag>->find("img") as $img) //Start searching for img tag in all (divs) you found
>         {
>             echo $img->src . "<br>"; //Output the information from the img's src attribute (if the found tag is <img
> src="www.example.com/cat.png"> you will get www.example.com/cat.png as
> result)
>         }
>     }

Please find the attachedimage

Thanks in advance