1. Go to this page and download the library: Download floda/yahoo_finance library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
floda / yahoo_finance example snippets
// Instance Object
$yf = new \floda\yahoo_finance\YF();
//Params
$symbol ="TRAN.BA"; //tickers with no .XX, API will return US stock market ticker
//for example: $symbol="AAPL";
// For another countries, you can use for example:
// .BA -> Argentina -> Buenos Aires Stock Exchange (BYMA)
$time_ago = "3 months"; //you can use xx days, xx weeks, xx months, xx years, etc
$historical = $yf->getHistorical($symbol, $time_ago);
/*
Array
(
[0] => Array
(
[date] => 2019-10-04
[open] => 21.950001
[high] => 22.9
[low] => 21.950001
[close] => 22.9
[adjClose] => 22.9
[volume] => 277948
)
....
....
[59] => Array
(
[date] => 2020-01-03
[open] => 25.5
[high] => 25.549999
[low] => 24.5
[close] => 24.950001
[adjClose] => 24.950001
[volume] => 229283
)
)
*/