php simple html dom
Posted in
2
6:20 am, August 31, 2018
simple html dom extract attributes simplehtmldom
this is if you have an element as follows, and you want to extract attributes from it.
<img class="an-image-wow" src="image.jpg" data-image="data-image.jpg" alt="my alt tag">
list all its attributes too see which ones we can access
foreach($html->find('img[data-original]') as $img) { var_dump($img->attr); }
here is how you extract the data-image
information
foreach($html->find('img[data-original]') as $img) { echo $img->attr['data-original']; // works!!! echo "<br>"; }
View Statistics
This Week
10
This Month
115
This Year
0
Add Comment
Other Items in php simple html dom
Related Search Terms
Other Categories in Code
c testing apache apps asp bat bootstrap bootstrap templates core css css grid design elements fancybox fonts foundation framework gimp git html icons ideas images javascript jquery js linux mac nginx node php php functions php simple html dom pi400 python react sections site bugs site documentation sql sqlite sublime svg templates tools virtual box webdev windows wordpress