function GetFromMylnikov($bssid) { $tries = 3; while (!($data = cURL_Get("http://api.mylnikov.org/wifi/main.py/get?bssid={$bssid}")) && $tries > 0) { $tries--; sleep(2); } $result = ''; $json = json_decode($data); if ($json->result == 200) { $latitude = $json->data->lat; $longitude = $json->data->lon; $result = $latitude . ';' . $longitude; } return $result; }
function QueryRangeFromRIPE($IP) { $data = cURL_Get("http://rest.db.ripe.net/search.json?type-filter=inetnum&flags=one-less&flags=no-irt&flags=no-referenced&query-string={$IP}"); $json = json_decode($data); if (is_null($json)) { return; } $atribute = $json->objects->object[0]->attributes->attribute; $inetnum = array_filter($atribute, function ($obj) { return $obj->name == 'inetnum'; }); $inetnum = $inetnum[0]->value; $inetnum = explode(" - ", $inetnum); $descr = implode(" | ", array_map(function ($obj) { return $obj->value; }, array_filter($atribute, function ($obj) { return $obj->name == 'descr'; }))); return array('startIP' => $inetnum[0], 'endIP' => $inetnum[1], 'descr' => $descr); }
function GetFromMylnikov($bssid) { $tries = 3; $proto = 'https:'; while (!($data = cURL_Get("{$proto}//api.mylnikov.org/wifi/main.py/get?bssid={$bssid}", '')) && $tries > 0) { $tries--; $proto = $tries % 2 == 0 ? 'http:' : 'https:'; sleep(2); } $result = ''; if (!$data) { return $result; } $json = json_decode($data); if (!$json) { return $result; } if ($json->result == 200) { $latitude = $json->data->lat; $longitude = $json->data->lon; $result = $latitude . ';' . $longitude . ';mylnikov'; } return $result; }