Greg Hauptmann
2007-Jan-13 06:05 UTC
Which country did a user request come from? How can I determine this???
Hi, Can anybody recommend a means to determine the country that an incoming user request is originating from? I''m guessing that you would first get the IP from the HTTP header and then somehow translate this? Is there a service that can be used for this? Is there a set of rules that one can use to implement within your rails application? Any advice welcome, even if the best possible is only a 95% accuracy thing. Thanks in advance Greg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Greg Hauptmann
2007-Jan-13 06:09 UTC
Re: Which country did a user request come from? How can I determine this???
PS Meant to ask too whether a rails plugin exists for this, and whether this can be done for free (i.e. without having to pay to subscribe to a service). On 1/13/07, Greg Hauptmann <greg.hauptmann.ruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > Can anybody recommend a means to determine the country that an incoming > user request is originating from? > > I''m guessing that you would first get the IP from the HTTP header and then > somehow translate this? Is there a service that can be used for this? Is > there a set of rules that one can use to implement within your rails > application? Any advice welcome, even if the best possible is only a 95% > accuracy thing. > > Thanks in advance > Greg >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Elad Meidar - Creopolis.com
2007-Jan-13 09:35 UTC
Re: Which country did a user request come from? How can I determine this???
Yap, use GeoIP gem (look in www.gemjack.com). the free version will reply to you with a country. works great, i use it myself in one project. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Greg Hauptmann
2007-Jan-13 09:37 UTC
Re: Which country did a user request come from? How can I determine this???
thanks for the reply Elad - I''ll have a look right now - how accurate do you find www.gemjack.com to be? On 1/13/07, Elad Meidar - Creopolis.com <eize.sus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Yap, use GeoIP gem (look in www.gemjack.com). the free version will > reply to you with a country. > > works great, i use it myself in one project. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dankelley
2007-Jan-13 13:20 UTC
Re: Which country did a user request come from? How can I determine this???
Any idea why the following fails? $ ls -l /usr/share/GeoIP/GeoIP.dat -rwxr-xr-x 1 root wheel 682474 Jan 13 09:17 /usr/share/GeoIP/GeoIP.dat $ cat a.rb require ''geoip'' p GeoIP.new(''/usr/share/GeoIP/GeoIP.dat'').country("www.netscape.sk") $ RUBYOPT=rubygems ruby a.rb /usr/lib/ruby/gems/1.8/gems/geoip-0.3.0/lib/geoip.rb:273:in `getaddress'': getaddrinfo: No address associated with nodename (SocketError) from /usr/lib/ruby/gems/1.8/gems/geoip-0.3.0/lib/geoip.rb:273:in `country'' from a.rb:2 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dankelley
2007-Jan-13 14:02 UTC
Re: Which country did a user request come from? How can I determine this???
(Replying to self). The problem is that www.netscape.sk does not exist. The code works with existing sites. Sorry for the confusion... On Jan 13, 9:20 am, "dankelley" <Dan.Kel...-gCeW8nNvq2Y@public.gmane.org> wrote:> Any idea why the following fails? >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---