I would like to gather the historical price data shown on this page and format the output as a csv file.
require_once('simple_html_dom.php');
$html = file_get_html("https://coinmarketcap.com/currencies/binance-coin/historical-data/?start=20180101&end=20180519"); // you don't need to use curl
$yourDesiredContent = $html->find('#historical-data .table', 0)->plaintext;
The problem is this gathers everything into one "string" but I need to seperate each td value in the table with a comma or whatever is appropriate for csv format.
Output:
Date Open High Low Close Volume Market Cap May 18, 2018 12.36 16.22 12.05 15.14 243,261,000 1,409,710,000 May 17, 2018 12.32 12.97 12.27 12.46 54,251,500 1,404,490,000 May 16, 2018 12.56 12.57 11.95 12.26 35,233,200 1,432,140,000 May 15, 2018 12.85 13.27 12.51 12.57 45,696,200 1,465,880,000 May 14, 2018 13.16 13.17 12.36 12.87 49,317,700 1,500,590,000 May 13, 2018 13.01 13.55 12.74 13.12 70,816,500 1,483,450,000 May 12, 2018 12.97 13.15 12.25 12.94 44,001,000 1,479,430,000 May 11, 2018 13.88 14.09 12.59 12.99 57,027,500 1,582,950,000 May 10, 2018 14.68 15.05 13.82 13.82 68,250,000
Is it possible I can do this?