adi code
adi code

Reputation: 1

Scraping data from a website with Simple HTML Dom

I work to finish an API for a website (https://rushwallet.com/) for github.

I am using PHP and attempting to retrieve the wallet address from this URL: https://rushwallet.com/#n3GjsndjdCURphhsqJ4mQH7AjiXlGI. Can anyone can help me?

My code so far:

$url = "https://rushwallet.com/#n3GjsndjdCURphhsqJ4mQH7AjiXlGI";

$open_url = str_get_html(file_get_contents($url));

$content_url = $open_url->find('span[id=btcBalance]', 0)->innertext;
die(var_dump($content_url));

Upvotes: 0

Views: 277

Answers (1)

Ben
Ben

Reputation: 5129

You cannot read the correct content in this case. You are trying to access the non-rendered page content. Therefore, you always read the empty string. The content is loaded after the page is fully loaded. The page source is shown as:

฿<span id="btcBalance"></span>

If you want to scrape the data in this case, you need to use rendering engine which is possible to render javascript. One possible engine is phantomJS, which is a headless browser and able to scrape the data after rendering.

Upvotes: 0

Related Questions