%@ Language=VBScript %>
<%Option Explicit
Response.ExpiresAbsolute = #January 1,2000 00:00:00#
Dim objXML, I, objItemList, objItem, xmlfile, items(20), Location, IP, Dt,Vi,sDate,sTime, Flag
Dim FlagSource, MapKey
FlagSource = "http://www.replyat.com/ImagesFlagBig/"
Dt = Now()
sDate = FormatDateTime(Dt,1)
sTime = FormatDateTime(Dt,3)
Vi = "Welcome Visitor from"
If Trim( Request.QueryString( "I" )) = "" Then
IP = request.ServerVariables("REMOTE_ADDR")
Else
IP = Request.QueryString("I")
End if
'
' users are required to get their own key for their site from ipinfodb.com
'
xmlfile = "http://api.ipinfodb.com/v3/ip-city/?key=eb50ed72c7d940f4b93811b900b1f3039b2ab0ef562b47452f91ffc5903&ip="& IP &"&format=xml"
set objXML = server.CreateObject("MSXML2.DOMDocument.6.0")
objXML.async = "false"
objXML.resolveExternals = "false"
objXML.setProperty "ServerHTTPRequest", true
objXML.Load(xmlfile)
If objXML.parseError.errorCode = 0 Then
Set objItemList = objXML.getElementsByTagName("Response")
For Each objItem In objItemList
For I = 0 to objItem.childNodes.length - 1
items(I) = objItem.childNodes(I).text
Next
Next
Set objItemList = Nothing
Else
Response.Write " This XML file is giving error !" & "
" & VbCrLf
End If
Set objXML = Nothing
Flag = FlagSource & items(3) & ".png"
Location = Vi & "
" & items(6)& ", " & items(5)& "
" & items(4)
%>
Steps used to show country name and flag on Google Map by using IP address
|
|
Explains steps used to show
country name and flag by using IP address location |
|
|
'' There appears to be no provisions in google maps
to get country location from an IP address.
'' For this purpose we can take the help of other sites that provide
necessary information.
''
'' There are many sites that assist to get country details from an IP
address.
'' We are using services of http://ipinfodb.com/ to get the required
details.
|
To test this page use
http://www.replyat.com/gadgetGetCountryFlagFromIpDetails.asp?I=207.216.148.32
where |
value of "I" can have any IP address |
If you don't provide the IP address by not using "?I=207.216.148.32"
, it will take IP address of the user. |
|
Steps used to show
country name and flag by using IP address |
This page uses ASP script to show country name, flag
and the location on google map. A study of this script will help
programmers develop their own similar gadget |
|
A complete working
script can be copied from
this txt file |
You will be required to use value of Keys for
http://ipinfodb.com/
and Google Maps API V3 for your own site. |
|
You can collect value of Lat Long
from a data base and pass these values to HTML file to show location on
Google map |
See also >>
How to pass Lat Long to HTML file to
show the location on Google map. |
|
|
|
|
|
|