brute-force guess:
curl ipinfo.io/json
{
"ip": "xx.xx.xx.xx",
"city": "Dve Mogili",
"region": "Ruse",
"country": "BG",
"loc": "43.5926,25.8749",
"org": "AS59900 Balkan Internet Exchange Ltd",
"postal": "7158",
"timezone": "Europe/Sofia",
"readme": "https://ipinfo.io/missingauth"
}
smil3y@debian:~$ curl http://www.geoplugin.net/json.gp
{
"geoplugin_request":"xx.xx.xx.xx",
"geoplugin_status":200,
"geoplugin_delay":"2ms",
"geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from <a href='http:\/\/www.maxmind.com'>http:\/\/www.maxmind.com<\/a>.",
"geoplugin_city":"Byala",
"geoplugin_region":"Ruse",
"geoplugin_regionCode":"18",
"geoplugin_regionName":"Ruse",
"geoplugin_areaCode":"",
"geoplugin_dmaCode":"",
"geoplugin_countryCode":"BG",
"geoplugin_countryName":"Bulgaria",
"geoplugin_inEU":1,
"geoplugin_euVATrate":20,
"geoplugin_continentCode":"EU",
"geoplugin_continentName":"Europe",
"geoplugin_latitude":"43.4465",
"geoplugin_longitude":"25.7358",
"geoplugin_locationAccuracyRadius":"1",
"geoplugin_timezone":"Europe\/Sofia",
"geoplugin_currencyCode":"BGN",
"geoplugin_currencySymbol":"лв",
"geoplugin_currencySymbol_UTF8":"лв",
"geoplugin_currencyConverter":1.812
}
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
const QJsonDocument jsondoc = QJsonDocument::fromJson(payload);
const QVariantMap jsonmap = jsondoc.toVariant().toMap();
const QStringList location = jsonmap["loc"].toString().split(QLatin1Char(','));
- // TODO: which is which?
const QString latitude = (location.size() == 2 ? location.at(0) : QString());
const QString longitude = (location.size() == 2 ? location.at(1) : QString());
const QLocale locale(jsonmap["country"].toString());