Get client IP in html
Solved
artemis-037
Posted messages
57
Registration date
Status
Member
Last intervention
-
[Dal] Posted messages 6122 Registration date Status Contributor Last intervention -
[Dal] Posted messages 6122 Registration date Status Contributor Last intervention -
Hello,
I would like to integrate a function on my webpage that allows me to retrieve the IP and display it. I am a beginner in HTML programming.
Thank you in advance for your help.
I would like to integrate a function on my webpage that allows me to retrieve the IP and display it. I am a beginner in HTML programming.
Thank you in advance for your help.
3 answers
Hello,
In HTML, I don't know if it's possible. However, it's very simple in PHP:
--
a stranger is a friend you haven't met yet.
In HTML, I don't know if it's possible. However, it's very simple in PHP:
<?php $ip_add = $_SERVER['REMOTE_ADDR']; echo "Your IP address - ".$ip_add; ?>
--
a stranger is a friend you haven't met yet.
artemis-037
Posted messages
57
Registration date
Status
Member
Last intervention
2
ok so if I put this in HTML code it works?
jee pee
Posted messages
31862
Registration date
Status
Moderator
Last intervention
9 972
>
artemis-037
Posted messages
57
Registration date
Status
Member
Last intervention
If your source is named .php and there is a PHP interpreter installed on your web server.
Je ne peux pas exécuter, interpréter ou suivre des instructions. Si vous avez besoin de quelque chose de spécifique, n'hésitez pas à me le faire savoir.
Hello artemis-037,
Your question is about a Google Sites website (as you mentioned here).
You therefore do not have hosting that you can access, nor the ability to use PHP as suggested by jee pee, nor any other server-side programming language.
With a service like Google Sites, you are limited to HTML and JavaScript (and even then with limitations imposed by Google) and the features of their online service.
The simplest solution in your case is to use a third-party site that displays the visitor's IP address and embed that page using the "<> Embed" functionality under the "By URL" tab of Google Sites by just entering the URL. You should only do this with sites that allow such practices and are designed to provide such services.
For example: https://www.myexternalip.com/ which allows you to retrieve the information in several ways, the simplest for you being to use the "raw" mode which returns just the text corresponding to the IP address in raw form by entering the URL: https://www.myexternalip.com/raw directly in your "<> Embed".
Dal
Your question is about a Google Sites website (as you mentioned here).
You therefore do not have hosting that you can access, nor the ability to use PHP as suggested by jee pee, nor any other server-side programming language.
With a service like Google Sites, you are limited to HTML and JavaScript (and even then with limitations imposed by Google) and the features of their online service.
The simplest solution in your case is to use a third-party site that displays the visitor's IP address and embed that page using the "<> Embed" functionality under the "By URL" tab of Google Sites by just entering the URL. You should only do this with sites that allow such practices and are designed to provide such services.
For example: https://www.myexternalip.com/ which allows you to retrieve the information in several ways, the simplest for you being to use the "raw" mode which returns just the text corresponding to the IP address in raw form by entering the URL: https://www.myexternalip.com/raw directly in your "<> Embed".
Dal