[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to get the remote_host  name of a visitor?

Posted on 2001-07-21
12
Medium Priority
?
932 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

656 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