<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>eXpand yOur cReativity &#187; ip address</title>
	<atom:link href="http://blog.bhushangahire.net/tag/ip-address/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bhushangahire.net</link>
	<description></description>
	<lastBuildDate>Thu, 05 Jan 2012 07:17:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Get location from IP address in Ruby On Rails for free&#8230;.</title>
		<link>http://blog.bhushangahire.net/2009/05/20/get-location-from-ip-address-in-ruby-on-rails-for-free/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=get-location-from-ip-address-in-ruby-on-rails-for-free</link>
		<comments>http://blog.bhushangahire.net/2009/05/20/get-location-from-ip-address-in-ruby-on-rails-for-free/#comments</comments>
		<pubDate>Wed, 20 May 2009 09:42:07 +0000</pubDate>
		<dc:creator>Bhushan Ahire</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ip address]]></category>
		<category><![CDATA[location]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=116</guid>
		<description><![CDATA[Find below the code for finding location from IP address using IP location tools. require 'net/http' require 'rexml/document' include REXML class MapsController < ApplicationController def index @location = locateIp() end def locateIp ip = request.remote_ip ips = ip.to_s url = "http://iplocationtools.com/ip_query.php?ip="+ips xml_data = Net::HTTP.get_response(URI.parse(url)).body xmldoc = REXML::Document.new(xml_data) # Now get the root element root = [...]]]></description>
			<content:encoded><![CDATA[<div class="snap_preview">
<p>Find below the code for finding location from IP address using <a href="http://www.iplocationtools.com/">IP location tools</a>.</p>
<pre>require 'net/http'
require 'rexml/document'
include REXML

class MapsController < ApplicationController
	def index
		@location = locateIp()

	end

	def locateIp
		ip = request.remote_ip
		ips = ip.to_s
		url = "http://iplocationtools.com/ip_query.php?ip="+ips

		xml_data = Net::HTTP.get_response(URI.parse(url)).body

                xmldoc = REXML::Document.new(xml_data)

		# Now get the root element
		root = xmldoc.root
		city = ""
		regionName = ""
		countryName = ""

		# This will take country name...
		xmldoc.elements.each("Response/CountryName") {
		|e| countryName << e.text
	    }

		# Now get city name...
		xmldoc.elements.each("Response/City") {
   		|e| city << e.text
	    }

		# This will take regionName...
		xmldoc.elements.each("Response/RegionName") {
   		|e| regionName << e.text
	    }

     	ipLocation = city +", "+regionName+", "+countryName

	 return ipLocation
   end #end of method locateIp

end</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2009/05/20/get-location-from-ip-address-in-ruby-on-rails-for-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

