ASP Geolocation Web Service
The ASP Geolocation web service API 1) allows you to directly program your back-end ASP scripts to deliver dynamic geo-localized pages using the ASP elements provided by geoPlugin.
To access this service, add the following url to a remote include call
http://www.geoplugin.net/asp.gp?ip=xx.xx.xx.xx
Of course, substitute the xx's with your visitor's IP number.
Example output of an ASP query output for your IP address (3.236.86.184) is:
geoplugin_request=@0"3.236.86.184"@1geoplugin_status=@2"200"@3geoplugin_delay=@4"1ms"@5geoplugin_credit=@6"Some of the returned data includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com."@7geoplugin_city=@8"Ashburn"@9geoplugin_region=@10"Virginia"@11geoplugin_regionCode=@12"VA"@13geoplugin_regionName=@14"Virginia"@15geoplugin_areaCode=@16""@17geoplugin_dmaCode=@18"511"@19geoplugin_countryCode=@20"US"@21geoplugin_countryName=@22"United States"@23geoplugin_inEU=@24"0"@25geoplugin_euVATrate=@26""@27geoplugin_continentCode=@28"NA"@29geoplugin_continentName=@30"North America"@31geoplugin_latitude=@32"39.0469"@33geoplugin_longitude=@34"-77.4903"@35geoplugin_locationAccuracyRadius=@36"1000"@37geoplugin_timezone=@38"America/New_York"@39geoplugin_currencyCode=@40"USD"@41geoplugin_currencySymbol=@42"$"@43geoplugin_currencySymbol_UTF8=@44"$"@45geoplugin_currencyConverter=@46"0"@47
An example ASP code snippet making use of this output is:
<% Set objGetData = Server.CreateObject("Microsoft.XMLHTTP" ) objGetData.Open "GET" , "http://www.geoplugin.net/asp.gp?ip=3.236.86.184", FALSE objGetData.sEnd TheData = objGetData.Responsetext Set objGetData = Nothing iRequest=InStr(TheData,"@0") iRequestEnd= InStr(TheData,"@1") - iRequest strRequest=Mid(TheData,iRequest+3,iRequestEnd-4) iStatus=InStr(TheData,"@2") istatusEnd= InStr(TheData,"@3") - iStatus strStatus=Mid(TheData,iStatus+3,iStatusEnd-4) iCity=InStr(TheData,"@4") iCityEnd= InStr(TheData,"@5") - iCity strCity=Mid(TheData,iCity+3,iCityEnd-4) iRegion=InStr(TheData,"@6") iRegionEnd= InStr(TheData,"@7") - iRegion strRegion=Mid(TheData,iRegion+3,iRegionEnd-4) iAreaCode=InStr(TheData,"@8") iAreaCodeEnd= InStr(TheData,"@9") - iAreaCode strAreaCode=Mid(TheData,iAreaCode+3,iAreaCodeEnd-4) iDmaCode=InStr(TheData,"@10") iDmaCodeEnd= InStr(TheData,"@11") - iDmaCode strDmaCode=Mid(TheData,iDmaCode+2,iDmaCodeEnd-5) iCountryCode=InStr(TheData,"@12") iCountryCodeEnd= InStr(TheData,"@13") - iCountryCode strCountryCode=Mid(TheData,iCountryCode+4,iCountryCodeEnd-5) icountryName=InStr(TheData,"@14") icountryNameEnd= InStr(TheData,"@15") - icountryName strcountryName=Mid(TheData,icountryName+4,icountryNameEnd-5) icontinentCode=InStr(TheData,"@16") icontinentCodeEnd= InStr(TheData,"@17") - icontinentCode strcontinentCode=Mid(TheData,icontinentCode+4,icontinentCodeEnd-5) ilatitude=InStr(TheData,"@18") ilatitudeEnd= InStr(TheData,"@19") - ilatitude strlatitude=Mid(TheData,ilatitude+4,ilatitudeEnd-5) ilongitude=InStr(TheData,"@20") ilongitudeEnd= InStr(TheData,"@21") - ilongitude strlongitude=Mid(TheData,ilongitude+4,ilongitudeEnd-5) iregionCode=InStr(TheData,"@22") iregionCodeEnd= InStr(TheData,"@23") - iregionCode strregionCode=Mid(TheData,iregionCode+4,iregionCodeEnd-5) iregionName=InStr(TheData,"@24") iregionNameEnd= InStr(TheData,"@25") - iregionName strregionName=Mid(TheData,iregionName+4,iregionNameEnd-5) icurrencyCode=InStr(TheData,"@26") icurrencyCodeEnd= InStr(TheData,"@27") - icurrencyCode strcurrencyCode=Mid(TheData,icurrencyCode+4,icurrencyCodeEnd-5) icurrencySymbol=InStr(TheData,"@28") icurrencySymbolEnd= InStr(TheData,"@29") - icurrencySymbol strcurrencySymbol=Mid(TheData,icurrencySymbol+4,icurrencySymbolEnd-5) icurrencyConverter=InStr(TheData,"@30") icurrencyConverterEnd= InStr(TheData,"@31") - icurrencyConverter strcurrencyConverter=Mid(TheData,icurrencyConverter+4,icurrencyConverterEnd-5) %>Many thanks to Savas for getting the ASP webservice working!
ASP Geolocation Currency Converter
The “geoplugin_currencyConverter” element is the conversion rate for the currency converter base currency.
Like all calls to any of geoPlugin's web services, the default base_currency is USD ($US).
Thus, if your base currency is NOT $US, then you must add the variable base_currency=XXX to the call to geoplugin.net eg
http://www.geoplugin.net/asp.gp?base_currency=EUR
Now the geoplugin_currencyConverter element will output the exchange rate of one Euro for your visitor.
The base_currency value must be a valid ISO 4217 3-letter code.
See also
- In-depth User Guide
-
- ASP
-
-