Página 1 de 1

GeoPlugin Script

Publicado: 07 Ene 2012 22:29
por Ceone
GeoPlugin Script es un codgo que nos permite mostrar la informacion de una ip en concreto, este script usa un soporte de google, espero que os guste.

Código:
Geo = {};

function Geo.GetInformation(strIP)
	local strCode = HTTP.Submit("http://www.geoplugin.net/xml.gp?ip="..strIP, {}, SUBMITWEB_GET, 20, 80, nil, nil);
	if (strCode == "") then
		return false
	else
		XML.SetXML(strCode);
		if (Application.GetLastError() ~= 0) then
			return false
		else
			return true
		end
	end
end

function Geo.GetCountry()
	return XML.GetValue("geoPlugin/geoplugin_countryName");
end

function Geo.GetCity()
	return XML.GetValue("geoPlugin/geoplugin_city");
end

function Geo.GetLatitude()
	return XML.GetValue("geoPlugin/geoplugin_latitude");
end

function Geo.GetLongitude()
	return XML.GetValue("geoPlugin/geoplugin_longitude");
end

function Geo.GetContinentCode()
	return XML.GetValue("geoPlugin/geoplugin_continentCode");
end

function Geo.GetRegion()
	return XML.GetValue("geoPlugin/geoplugin_region");
end

function Geo.GetRegionCode()
	return XML.GetValue("geoPlugin/geoplugin_regionCode");
end

function Geo.GetCountryCode()
	return XML.GetValue("geoPlugin/geoplugin_countryCode");
end

function Geo.GetCurrencyCode()
	return XML.GetValue("geoPlugin/geoplugin_currencyCode");
end

function Geo.ClearCache()
	XML.SetXML("");
end
Ejemplo:
if Geo.GetInformation(System.GetLANInfo().IP) then
	-- load all information
	local strCountry = Geo.GetCountry();
	local strCountryCode = Geo.GetCountryCode();
	local strCity = Geo.GetCity();
	local numLatitude = Geo.GetLatitude();
	local numLongitude = Geo.GetLongitude();
	local strContinentCode = Geo.GetContinentCode();
	local strRegion = Geo.GetRegion();
	local numRegionCode = Geo.GetRegionCode();
	local strCurrencyCode = Geo.GetCurrencyCode();
	
	-- Error filter
	if (strCountry ~= "")
	and (strCountryCode ~= "")
	and (strCity ~= "")
	and (numLatitude ~= nil)
	and (numLongitude ~= nil)
	and (strContinentCode ~= "")
	and (strRegion ~= "")
	and (numRegionCode ~= nil)
	and (strCurrencyCode ~= "")
	then
		-- All Text
		ALL_str = "Country: "..strCountry.."\r\nCountry Code: "..strCountryCode.."\r\nCity: "..strCity
		ALL_str = ALL_str.."\r\nLatitude: "..numLatitude.."\r\nLongitude: "..numLongitude.."\r\nContinentCode: "..strContinentCode
		ALL_str = ALL_str.."\r\nRegion: "..strRegion.."\r\nRegionCode: "..numRegionCode.."\r\nCurrencyCode: "..strCurrencyCode
		
		-- Set Input text
		Input.SetText("Input1", ALL_str);
	end
	-- Clear Cache 
	Geo.ClearCache();
end
Podréis encontrar el APZ aquí: viewtopic.php?f=12&t=1232

Re: GeoPlugin Script

Publicado: 16 Ene 2012 15:44
por abood1987
thank you

Re: GeoPlugin Script

Publicado: 14 Feb 2012 01:16
por timveer
:google: "Translate attack"

Gracias Ceone para el excelente guión.

Creo que para usar este script con Lua Socket también evitar cualquier retraso de la HTTP.Submit colgando de la aplicación

EDIT: Pero Multiupload está abajo... otro lugar?

Re: GeoPlugin Script

Publicado: 19 Feb 2012 20:31
por Ceone
timveer escribió::google: "Translate attack"

Gracias Ceone para el excelente guión.

Creo que para usar este script con Lua Socket también evitar cualquier retraso de la HTTP.Submit colgando de la aplicación

EDIT: Pero Multiupload está abajo... otro lugar?

APZ update...

Podréis encontrar el APZ aquí: viewtopic.php?f=12&t=1232