Identifying Similar Contents
Posted: Tue Jan 19, 2010 9:00 am
Consider I have two Web pages and i have one image that appears in both the web pages ..
Please post the code that will help me to find the image that is repeated in both the web page and a way to block the image ..
my idea is to find the contents(the file name given within quotes) of the img tag and then compare with the img tag in the second page to find out the content that is repeated..
i tried using the code below but it says nesting level is too deep here if(in_array($element_a,$images_b)) ...
please help me to find the similar images and block them from being displayed
$html_a = file_get_html('http://www.website.com/page_a.html');
$html_b = file_get_html('http://www.website.com/page_b.html');
// Find all images
$images_a = $html_a->find('img');
$images_b = $html_b->find('img');
foreach($images_a as $element_a) {
if(in_array($element_a,$images_b)) {
echo $element_a->src . ' is on both sites<br>';
}
}
Please post the code that will help me to find the image that is repeated in both the web page and a way to block the image ..
my idea is to find the contents(the file name given within quotes) of the img tag and then compare with the img tag in the second page to find out the content that is repeated..
i tried using the code below but it says nesting level is too deep here if(in_array($element_a,$images_b)) ...
please help me to find the similar images and block them from being displayed
$html_a = file_get_html('http://www.website.com/page_a.html');
$html_b = file_get_html('http://www.website.com/page_b.html');
// Find all images
$images_a = $html_a->find('img');
$images_b = $html_b->find('img');
foreach($images_a as $element_a) {
if(in_array($element_a,$images_b)) {
echo $element_a->src . ' is on both sites<br>';
}
}