Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How to check the origin ofi a visitor?

by arden (Curate)
on Jun 19, 2004 at 21:53 UTC ( [id://368210]=note: print w/replies, xml ) Need Help??


in reply to How to check the origin ofi a visitor?

At what point do you want to know this information? Is it going to be when they are requesting a page that is being fed to them by a Perl script? Is it when you're going through the logs later on with a Perl script? How are they "coming" to your system? HTTP? FTP? Telnet?

Now, to make a few assumptions: You are refering to HTTP traffic as it is being requested through CGI. In this case, you could either attempt to track down the IP number the requestor is giving using IP::Country, Apache::Geo::IP, or just Geo::IP, accepting the fact that some IP numbers are multi-national and also that a user can be in one location, requesting a document through a proxy located somewhere totally else.

Another option is that you could check the values of Accept-Language and assume they are where their first choice is (although this is going to be set to US most of the time by default) or look within the User-Agent field for some value that might be set. Using this method (or one like it) you have to accept that the requestor can put bad data into the header, so it, too, cannot be guaranteed to be correct.

- - arden.

  • Comment on Re: How to check the origin ofi a visitor?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://368210]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-18 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found