?
Solved

How to get the remote_host  name of a visitor?

Posted on 2001-07-21
12
Medium Priority
?
925 Views
Last Modified: 2008-03-10
Dear Experts,
I am using php and i would like to apply statistic information for my site.

Using The Apache - php variable $REMOTE_ADDR i have the remote IP of each visitor.
I need to know the location (the server name) from which the user is connected to the internet, such as to say that :

visitor #1 IP:195.97.50.61 connected from vdp029.lar01.cas.hol.gr at time (timestamp of visitor 1)

visitor #2 IP:212.205.88.209 connected from 212.205.88.209.stsnet.gr at time (timestamp of visitor 2)
.
.
.

Could anyone help me?
Thanks

0
Comment
Question by:spap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6304722
Rather than re-inventing the wheel, it might be worthwhile you checking out:

http://www.hotscripts.com/PHP/Scripts_and_Programs/Web_Traffic_Analysis/

Ant
0
 
LVL 15

Accepted Solution

by:
a.marsh earned 800 total points
ID: 6304725
0
 
LVL 8

Expert Comment

by:us111
ID: 6304817
If you'd like to get the real name (vdp029.lar01.cas.hol.gr) you need a whois scripts
http://www.hotscripts.com/PHP/Scripts_and_Programs/Networking_Tools/Whois/

All links provides by a.marsh are good.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Expert Comment

by:higijj
ID: 6304887
0
 
LVL 1

Expert Comment

by:manucorp
ID: 6306521
echo "visitor #1 IP:".$REMOTE_ADDR." connected from ".gesthostbyaddr($REMOTE_ADDR) at time (".date("D M j G:i:s Y").")";
0
 
LVL 1

Author Comment

by:spap
ID: 6312383
Ok Thanks All of you for your inerest. I need some time to evaluate the comments.

So far I tried the gesthostbyaddr command. The problem with this command is that the most ip adresses connot be resolved. As a result, in most cases, the gethostbyaddr returns the ip itselft.

 I have to try the us111 and the hqijj comment before accepting the a.marsh comment as an answer.

In case that the us111 or the hqijj comments overlap with the a.marsh comment i will accept the a.marsh's because it was the first response to my question.

Thanks all of you once again.
0
 
LVL 1

Author Comment

by:spap
ID: 6333809
Hi. the problem has as follows.
while the nslookup and host command of the linux works perfect in resolving an ip address, the php command

gesthostbyaddr($REMOTE_ADDR) does not work properly.

i.e

linux:
bash-2.04$ nslookup 213.249.18.67
Server:  localhost
Address:  127.0.0.1

Name:    cekif1.panafonet.gr
Address:  213.249.18.67        
---------------------------------------

bash-2.04$ host 213.249.18.67
67.18.249.213.IN-ADDR.ARPA domain name pointer cekif1.panafonet.gr
bash-2.04$    

------------------------------------------------

echo gesthostbyaddr(213.249.18.67);
output:213.249.18.67


what is going wrong?


0
 
LVL 2

Expert Comment

by:higijj
ID: 6334419
try using this instead of gethostbyaddr

echo gethostbyname(213.249.18.67);
0
 
LVL 1

Author Comment

by:spap
ID: 6337184
No hiqijj it does not work. the result is the ip itself.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6419240
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.

____________________________________________



Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

Experts, please do not add further "answer" information to this question.  I will be back in about one week to finalize this question.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange

P.S.  REGARDING POINTS, Guidelines and more:  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp  
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6419988
spap's earlier comment says:


Comment
From: spap  Date: 07/24/2001 06:10AM PST  
Ok Thanks All of you for your inerest. I need some time to evaluate the comments.

So far I tried the gesthostbyaddr command. The problem with this command is that the most ip adresses
connot be resolved. As a result, in most cases, the gethostbyaddr returns the ip itselft.

I have to try the us111 and the hqijj comment before accepting the a.marsh comment as an answer.

In case that the us111 or the hqijj comments overlap with the a.marsh comment i will accept the a.marsh's
because it was the first response to my question.

Thanks all of you once again.  

------------------------------------------


:o)

Ant
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6446660
Finalized by:
Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question