469,343 Members | 5,478 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

i need to get the client's computer name using php.

Dear Sir,

i need to get the client's computer name using php.
i tried some code like as below. but i get only client public ip or server information.
so can anyone help me to get client's infiormation.

Expand|Select|Wrap|Line Numbers
  1. echo php_uname();
  2. echo php_uname(n);
  3. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  4.  
  5. echo $hostname
  6.  
Regards,
Faruk Chowdhury.
Aug 1 '10 #1
5 16410
Markus
6,050 Expert 4TB
You can't.

PHP runs on a server, and, by definition, has little to do with a client visiting that server.
Aug 1 '10 #2
do you have any other solution to regarding this problem?
Aug 1 '10 #3
TheServant
1,168 Expert 1GB
You see the problem is that the internet and websites are mostly controlled by the users browser. Ultimately, you can send someone any bit of code, but if their browser can't interpret and/or run it, it will not work (hence why we hate IE so much). Although I have never tried it, you will need a client side language like javascript to attempt it. However, I think that javascript would run into restrictions because the computer might not give the browser the name to give to your script (for security reasons). In which case you will need to go to something like ASP which was made my Microsoft and has a bit more features. Communication back to PHP will be another hurdle you will have to jump after you achieve that.

Have you considered that people may not want to give you their computer name?
Aug 1 '10 #4
Atli
5,058 Expert 4TB
Have you considered that people may not want to give you their computer name?
This is the most important part in a discussion like this. You are given a very limited ability to discover details about your visitors for a reason: security. If any web server could load details about their clients, such as details about their network setup, it would make it that much easier for them to mount malicious attacks, or violate their user's privacy.

If you want such details about a client, you will need to get them through a client-side application. For that you need languages like Java to be installed on the client, which gives you the ability to *request* permission to access the client file system or execute system commands. The user can still deny you access, though.
Aug 1 '10 #5
Thanx to all..
Aug 3 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Maverick | last post: by
4 posts views Thread by Matt | last post: by
3 posts views Thread by RR | last post: by
9 posts views Thread by Dan Nash | last post: by
5 posts views Thread by z. f. | last post: by
8 posts views Thread by =?Utf-8?B?QkRSaWNoYXJkc29u?= | last post: by
2 posts views Thread by mitja | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.