Skip to content

Commit 36f7ec1

Browse files
committed
Geoext: Add support for geomac multiple location source receiver
However no public web service provided yet. Software: https://drygdryg.github.io/geomac-webpage/
1 parent 91ea87e commit 36f7ec1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

geoext.php

+32
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ function GetGeolocationServices()
5050
//'AlterGeo',
5151
//'Mylnikov',
5252
'MylnikovOpen',
53+
//'Multigeo',
5354
);
5455
}
5556
function GeoLocateAP($bssid, $svcs = null)
@@ -270,6 +271,37 @@ function GetFromMylnikovOpen($bssid)
270271
}
271272
return $result;
272273
}
274+
function GetFromMultigeo($bssid)
275+
{
276+
geoDbg("multigeo: $bssid");
277+
$tries = 3;
278+
while (!($data = cURL_Get("http://geomac.local/locate.php?mac=$bssid")) && ($tries > 0))
279+
{
280+
$tries--;
281+
sleep(2);
282+
}
283+
284+
$result = '';
285+
if (strpos($data, 'Results for ') === false) return $result;
286+
geoDebug('multigeo', $bssid, $data);
287+
$svc = 'apple';
288+
$line = getStringBetween($data, 'Apple | ', "\n");
289+
if (empty($line))
290+
{
291+
$svc = 'google';
292+
$line = getStringBetween($data, 'Google | ', "\n");
293+
}
294+
if (empty($line))
295+
return $result;
296+
$line = explode(', ', $line);
297+
$latitude = $line[0];
298+
$longitude = $line[1];
299+
if (handleGeoErrors('multigeo', $bssid, (float)$latitude, (float)$longitude))
300+
{
301+
$result = $latitude.';'.$longitude.';'.$svc;
302+
}
303+
return $result;
304+
}
273305
function cURL_Get($url, $proxy = '', $proxytype = -1, $proxyauth = '')
274306
{
275307
geoDbg("Fetching: $url");

0 commit comments

Comments
 (0)