2

Basically what I want to do is get a particular table row of a website. the table has an id of "table-data". I have already written the PHP but I noticed that the file_get_html doesn't actually get the data that is dynamically loaded. How should I approach?

include_once('simple_html_dom.php');

$html = file_get_html('http://www.2gheroon.ir');
$es = $html->find('table.data-table');

for ($i=0 ; $i<count($es); $i++) {
    echo $es[$i]->plaintext;
}

echo $html;
HessamSH
  • 357
  • 1
  • 5
  • 18
  • 1
    If it's dynamically loaded you can either try to find the json, or you can use something like selenium/nightmarejs – pguardiario Sep 06 '18 at 23:29
  • Your URL is not valid ... we can't see what you want to scrap ! No way to scrap dynamic content with simplehtmldom. Good luck to find the json. The proper way to fetch element + id : $ret = $html->find('div[id=foo]'); https://simplehtmldom.sourceforge.io/manual.htm – Hymed Ghenai Sep 09 '20 at 00:06

0 Answers0