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?? |
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.
In Section
Seekers of Perl Wisdom
|
|