1

I want to extract data that are in table #buyOrdersTable from here

https://bittrex.com/Market/Index?MarketName=BTC-XRP

To do this I am using PHP Simple HTML DOM Parser library and following code:

$html = file_get_html('https://bittrex.com/Market/Index?MarketName=BTC-XRP');

echo 'BTC/XRP<br>';

foreach($html->find('div.buy-table-container tr.dyn-tr-add td') as $td) 
{
    echo $td->plaintext . '<br>';
}

?>

I want to extract every row from BID section - SUM, TOTAL, SIZE (XRP), BID (BTC). But code doesn't find any row.

3
  • 2
    And it never will. That page is mostly pure javascript. Simple HTML DOM cannot execute javascript. Try disabling javascript in your browser; that's what the parser is seeing. Commented Oct 11, 2018 at 12:02
  • So there is any way to get that data using other techniques? Commented Oct 11, 2018 at 12:06
  • see my answer below Commented Oct 11, 2018 at 12:08

1 Answer 1

2

You can't do that. It's impossible, as explained by msg in the comments.

To do it properly, sign up for an API key, and call the API!

https://support.bittrex.com/hc/en-us/articles/115003723911-Developer-s-Guide-API

You'll probably want to use Guzzle, or cURL to make your requests. You can find lots of tutorials showing how to connect to any API using either.

This may or may not help you. A while back I started writing a library that hooked up to the BTC-e exchange (now Wex.nz). You can make adapters for any exchange, so you could tweak this code if you like.

https://github.com/delboy1978uk/BTCExchange/blob/master/src/Exchange/BtcE.php

Which extends this class https://github.com/delboy1978uk/BTCExchange/blob/master/src/Exchange/ExchangeAbstract.php

Credit to msg for bothering to check Packagist. There are many ready-to-rock Bittrex API packages waiting to be installed! https://packagist.org/?query=bitrex-api

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

4 Comments

There are several ready-made php implementations of the api. Can't vouch for the quality of them, but the second one looks fairly complete.
Even better! Fancy linking us up?
Thanks. It helps me a lot. I never thought that some exchanges providing API free.
Even more options, some with framework integration. @delboy1978uk feel free to add them directly to your answer if you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.