first work on meteo display

This commit is contained in:
2020-04-04 09:19:51 +02:00
parent 5a94759e35
commit 30e181f86d
8 changed files with 2095891 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class MeteoController extends Controller
{
public function index()
{
$idCity = 2995971;
$url = 'https://api.openweathermap.org/data/2.5/forecast?id='.$idCity.'&appid='.env('OPEN_WEATHER_MAP_API_KEY').'&units=metric&lang=fr';
$client = new \GuzzleHttp\Client();
$promise = $client->requestAsync('GET', $url);
$response = $promise->wait();
return $response->getBody()->getContents();
}
}