ASP Web Service
The ASP web service1) 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 (50.16.36.153) is:
geoplugin_request=@0"50.16.36.153"@1geoplugin_status=@2"200"@3geoplugin_credit=@4"Some of the returned data includes GeoLite data created by MaxMind, available from http://www.maxmind.com."@5geoplugin_city=@6"Ashburn"@7geoplugin_region=@8"VA"@9geoplugin_areaCode=@10"703"@11geoplugin_dmaCode=@12"511"@13geoplugin_countryCode=@14"US"@15geoplugin_countryName=@16"United States"@17geoplugin_continentCode=@18"NA"@19geoplugin_latitude=@20"39.043701"@21geoplugin_longitude=@22"-77.487503"@23geoplugin_regionCode=@24"VA"@25geoplugin_regionName=@26"Virginia"@27geoplugin_currencyCode=@28"USD"@29geoplugin_currencySymbol=@30"$"@31geoplugin_currencySymbol_UTF8=@32"$"@33geoplugin_currencyConverter=@34"1"@35
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=50.16.36.153", 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 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
-
