Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
fix(routes): call the good routes (#56)
Browse files Browse the repository at this point in the history
* fix(routes): call the good routes

* remove: useless variables and add spaces

* fix: link to the charts
  • Loading branch information
Jules010209 authored Sep 4, 2023
1 parent eae0937 commit 2cfbe70
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/temsiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ public function logique_time_temsi()
public function link_temsi_fr()
{

//https://aerometeo.fr/data/weather/temsi_france_202308310900.pdf
// https://aerometeo.fr/data/weather/temsi_france_202309042100.pdf
$link = "https://aerometeo.fr/data/weather/temsi_france_" . $this->logique_time_temsi() . ".pdf";
return $link;
}

public function link_wintemp_fr()
{

//https://aerometeo.fr/data/weather/wintem_france_202308310900.pdf
// https://aerometeo.fr/data/weather/wintem_france_202309042100.pdf
$link = "https://aerometeo.fr/data/weather/wintem_france_" . $this->logique_time() . ".pdf";
return $link;
}
Expand Down
18 changes: 13 additions & 5 deletions app/Http/Controllers/whazzupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,19 @@ public function Heurechange()
public function get_token()
{
$openid_url = 'https://api.ivao.aero/.well-known/openid-configuration';
$openid_url = 'https://api.ivao.aero/.well-known/openid-configuration';

$openid_result = file_get_contents($openid_url, false);

if ($openid_result === FALSE) {
/* Handle error */
die('Error while getting openid data');
}

$openid_data = json_decode($openid_result, true);

$idclient = env("ivao_api_client_id");
$secret = env("ivao_api_client_secret");

$token_req_data = array(
'grant_type' => 'client_credentials',
'client_id' => $idclient,
Expand All @@ -133,14 +137,18 @@ public function get_token()
'content' => http_build_query($token_req_data)
)
);

$token_context = stream_context_create($token_options);
$token_result = file_get_contents($openid_data['token_endpoint'], false, $token_context);

if ($token_result === FALSE) {
/* Handle error */
die('Error while getting token');
}

$token_res_data = json_decode($token_result, true);
$access_token = $token_res_data['access_token']; // Here is the access token

return $access_token;
}

Expand Down Expand Up @@ -205,22 +213,22 @@ public function API_request($path = null, $method = 'GET', $data = null, $header
}

public function Get_metar($icao=null){
$metar = $this->API_request("/v2/airports/".$icao."/metar");
$metar = $this->API_request("v2/airports/".$icao."/metar");
return $metar;
}

public function Get_taf($icao=null){
$metar = $this->API_request("/v2/airports/".$icao."/taf");
$metar = $this->API_request("v2/airports/".$icao."/taf");
return $metar;
}

public function Get_Position($icao=null){
$metar = $this->API_request("/v2/tracker/now/atc");
$metar = $this->API_request("v2/tracker/now/atc");
return $metar;
}

public function track_session_id($idsession = null){
$metar = $this->API_request("/v2/tracker/sessions/53150078");
$metar = $this->API_request("v2/tracker/sessions/" . $idsession);
return $metar;
}
}
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,6 @@
Route::get("test2", function (Request $request) {
$whazzup = new whazzupController();
$whazzup->API_request_session();
$u = $whazzup->track_session_id();
$u = $whazzup->track_session_id('53150078');
return $u->json();
})->name("test2");

0 comments on commit 2cfbe70

Please sign in to comment.