is there a way to get the remote client's username and computername through CGI in perl? I tried printing ENV hash in the CGI script but i couldnt get this information
No. That information is not passed over HTTP, and may not exist at all (e.g. my phone doesn't require me to log in with a username, it is a single user device).
You can get the IP address of the machine the request came from (which might be a proxy server), and use that to get the DNS (or other network protocol) name, but that is about as close as you can get.
Check out the remote_host and remote_addr methods. They are likely to get you as close as you will be able to get to a "computer name". Username is not likely passed at all via http headers (e.g. technically you may consider the authorization and/or email header to be close, however its unlikely either would be populated in most situations).
The remote_host method in particular performs a reverse DNS lookup. Should something be returned you will get the result, else you will simply get the remote address (e.g. ip).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With