X
X
xuxubla2015-04-30 07:12:57
PHP
xuxubla, 2015-04-30 07:12:57

Why does Simple HTML Dom find extra elements?

For some unknown reason, the parser finds elements that I don't see in the page code.

<?php
include_once 'simple_html_dom.php';
$url = 'http://www.felix.ru';
$html = new simple_html_dom();
$html -> load_file($url);
foreach ($html->find('a.Depth[href*=catalog], a.Depth2[href*=catalog]') as $e) {
  echo $e->href . '<br>';
}

For example, it displays the following links:
/catalogue/3245/333449/
/catalogue/2152/320429/
/catalogue/2152/320430/
Surely the answer lies on the surface. But own knowledge is not enough due to inexperience.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fortop, 2015-04-30
@xuxubla

The page that you are viewing in the browser and that your script received may be different even if the url is the same.
Therefore, save the resulting html to a file for debugging. And compare the results of the script with the contents of the file.

X
xmoonlight, 2015-04-30
@xmoonlight

it means they are really there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question