So here's my problem : I use the EOD Financial api to get data on a stock, on a Laravel/Vue.js project. On a Vue Component, I use axios to make a get Request like this :
const response1 = await axios.get("/getHistoricalDataNAME/"+String(self.stock.code)+'.'+String(self.stock.exchange))
.then((response) => {
with the function getHistoricalDataNAME being :
public function getHistoricalDataISIN(String $ISIN) {
$response = Http::get('https://eodhistoricaldata.com/api/eod/'.$ISIN.'?api_token='TOKEN');
return $response->body();
}
and it works perfectly. The result is an array, when I console.log() it, I have this :
Now, I'm trying to the exact same thing in a Laravel Command. So I made this command :
public function handle(EODController $EODController, Client $client)
{
$client = new Client(['verify' => false]);
$stock = Stock::find(8);
$stockEODname = strval($stock->code).'.'.strval($stock->exchange);
$EOD = $client->get('https://eodhistoricaldata.com/api/eod/'.$stockEODname.'?api_token=TOKEN');
var_dump(json_decode($EOD->getBody()->getContents()));
}
and it doesnt work. The var_dump just return NULL. The name of the stock is good, the $EOD variable is valid, everything seems fine but I don't know how to get an array like with the Axios method. What am I doing wrong ? Thank you !