Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
// using System.Net.Http; // using System.Net.Http.Headers; // using System.Text; // using System.Text.Json; static async Task
LoginAsync(HttpClient http, string email, string password) { var content = new FormUrlEncodedContent(new Dictionary
{ ["user_mail"] = email, ["password"] = password }); var res = await http.PostAsync("https://
/abf_api/login.php", content); res.EnsureSuccessStatusCode(); using var s = await res.Content.ReadAsStreamAsync(); using var doc = await JsonDocument.ParseAsync(s); return doc.RootElement.GetProperty("token").GetString(); } static async Task
GetPlanAsync(HttpClient http, string token, int pilotId) { var req = new HttpRequestMessage(HttpMethod.Get, $"https://
/abf_api/plan-get.php?pilote_id={pilotId}"); req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode(); return JsonDocument.Parse(await res.Content.ReadAsStringAsync()); } static async Task PushUpdateAsync(HttpClient http, string token, object payload) { var json = JsonSerializer.Serialize(payload); var req = new HttpRequestMessage(HttpMethod.Post, "https://
/abf_api/tracker-update.php"); req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); req.Content = new StringContent(json, Encoding.UTF8, "application/json"); var res = await http.SendAsync(req); res.EnsureSuccessStatusCode(); } // Usage (exemple) var http = new HttpClient(); var token = await LoginAsync(http, "pilote@example.com", "MotDePasse"); var plan = await GetPlanAsync(http, token, 1); // TODO: parser plan.RootElement.GetProperty("data") … await PushUpdateAsync(http, token, new { pilot_id = 1, ac_id = 179357, number = "ABF4053", departure = "LIRF", arrival = "LICC", flightstate = "enroute", lat = 41.799, lon = 12.246, altitude = 32000, ground_speed = 450, heading = 145, timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds() });
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)