I get the images and their URLs with the following code using Simple HTML DOM Parser:
<?php
include_once('simple_html_dom.php');
$url = "http://www.tokyobit.com";
$html = new simple_html_dom();
$html->load_file($url);
foreach($html->find('img') as $img){
echo $img . "<br/>";
echo $img->src . "<br/>";
}
?>
But the result does not look so good:

(source: netdna-cdn.com )
So, how can I style the output in CSS as with adding a class to each image and its src. My CSS:
.image-and-src {
border: 2px solid #777;
}
So how can I add this class ?: image-and-src
source
share