22 lines
519 B
PHP
22 lines
519 B
PHP
<?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();
|
|
|
|
}
|
|
}
|