i am developing a online chat application, for that i have a server with static ip.
i want to give only small javascript to include in client website.
here my requirement is obtain ip address and the location of the user of the website.
websites my in in any language like php,jsp,html,asp....for any wesite my script is same
please help me in this issue to solve..

i am giving script like
<script src="http://ipaddress/jascripts/chat.js"></script>

this script needs to retrive the ip address of the visitor of website..

Recommended Answers

You can try $_SERVER['REMOTE_ADDR'] but it may not be accurate.

Jump to Post

All 2 Replies

You can try $_SERVER['REMOTE_ADDR'] but it may not be accurate.

Little confused as to what you're trying to achieve. Do you want to get the user's IP address using Javascript or PHP/Other serverside language? Pritaeas' solution should work on the PHP end.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.