-1

I am trying parse data from this site: www.sberbank.ua/branches/, and I am using simple HTML DOM Parser.

I tried this:

include_once(dirname(__FILE__).'/simple_html_dom.php');
$html = file_get_html('http://www.sberbank.ua/branches/');
foreach($html->find("div.bitem") as $e) {
    echo $e->innertext."<br>";
}

This is the data that I need parse: screenshot

The problem is that the data is generated by javascript and when I tried get the DIV this was empty.

Please someone can help me to solve this?

5
  • Screen scraping is notoriously perilous. Have you tried hitting the URL in a browser without JavaScript turned on? Does the site in question have a non-JavaScript fallback? Commented Jan 25, 2017 at 16:14
  • @AndFisher yep I have tried it and the site doesn't works without javascript. There is not any GET request. Commented Jan 25, 2017 at 16:17
  • Then you cannot scrape the sites javascript generated information as file_get_html() does not run the javascript Commented Jan 25, 2017 at 16:23
  • @RiggsFolly thanks for your answer, what I could do ? Commented Jan 25, 2017 at 16:32
  • There is Nothing you can do Commented Jan 25, 2017 at 16:33

1 Answer 1

1

I solved this using Firebug extension for Firefox, with this I found the URL that the JS function uses to get the data. Finally I parsed the data from the new URL.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.