php simple html dom
  
 Posted in   
       638
      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
          
          
            100
          
        
            This Month
          
          
            534
          
        
            This Year
          
          
            1941
          
        Add Comment
Other Items in php simple html dom
Related Search Terms
Other Categories in Code
    alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps animation apache api apps asp bat blocking bootstrap bootstrap templates charts cookies core css css filters css grid design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac minecraft misc modal modals mysql nginx node php php errors php function php functions php simple html dom pi400 python react regex sections simple_html_dom simplepie php site bugs site documentation slick slick slider sql sqlite ssh sublime svg svg css templates tools video virtual box vscode vue webdev windows windows 11 windows commands wordpress 
  
 
    
   
	