faqts : Computers : Programming : Languages : Asp : ASP/VBScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

20 of 29 people (69%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

how can we get the country name from which a client requests a web page

Sep 24th, 2003 12:48
Nagesh Rai, devunoori kishan, http://cenvo.com


You can use the following piece of ASP code to get country details. 
goto http://pingme.info and checkout the IP whois option to get full 
details of the IP
<%
strXml="<pingme ip='"&Request.ServerVariables("REMOTE_ADDR")&"' />"
set XmlHttp=Server.CreateObject("Microsoft.XMLHTTP")
XmlHttp.open "POST","http://pingme.info/pingme.asp",false
XmlHttp.send(strXml)
strCountryShort=XmlHttp.responsexml.documentElement.getElementsByTagName
("countryshort").Item(0).Text
strCountryLong=XmlHttp.responsexml.documentElement.getElementsByTagName
("countrylong").Item(0).Text
strCountry=XmlHttp.responsexml.documentElement.getElementsByTagName
("countryname").Item(0).Text
Response.Write("Country Short:"&strCountryShort&"<br>")
Response.Write("Country Long:"&strCountryLong&"<br>")
Response.Write("Country Name:"&strCountry&"<br>")
%>



© 1999-2004 Synop Pty Ltd