Blog

tags: news software php opensource webdesign howto


31.Aug.2015 12:06 - last update: 05.Oct.2015 16:32

Öffentliche IP auslesen mit Webserver

Um sich die öffentliche IP anzeigen zu lassen - und man ist mit einem Webserver ausgestattet - dann läßt sich das mit einem kleinen Einzeiler realisieren.

Für viele Webdesigner ist das sicher ein alter Hut, aber ich wollte es trotzdem nochmals niederschreiben.

Man legt sich eine Datei auf dem Webserver an, z.Bsp. ip.php. In diese kopiert man den folgenden PHP-Code:

<?php echo $_SERVER['REMOTE_ADDR']; ?>

Ruft man in einem Browser der Wahl (z.Bsp. Firefox, Lynx etc) nun diese Seite auf, so erscheint als Antwort nur die IP, mit der diese Seite aufgerufen wurde. Das kann man prima benutzen, um z.Bsp. mit Lynx skriptgesteuert die IP herauszufinden.

Der Vorteil dieser Methode, gegenüber fremden Diensten ist; man braucht nicht irgendwelche Daten an Dritte übermitteln. Geht ja schließlich keinen was an, was im Request-header so alles übertragen wird...




comments

post a comment








😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏😐😑😒😓😔😕😖😗😘😙😚😛😜😝😞😟😠😡😢😣😤😥😦😧😨😩😪😫😬😭😮😯😰😱😲😳😴😵😶😷🙁🙂🙃🙄🙅🙆🙇🙈🙉🙊🙋🙌🙍🙎🤐🤑🤒🤓🤔🤕🤖🤗🤘🤠🤡🤢🤣🤤🤥🤦🤧👍𝄞🌍🌹🍻🍾

privacy declaration

Your IP-address, useragent-string etc are not stored by this blog-software. Still, it is possible that the hoster of this website may store data like this. But that is beyond the scope of this blog-software. Check out this website's privacy declaration to find out more about that!

This blog-software generally doesn't store any information about you. Only if you post a comment, some data will have to be stored. You don't have to input any personal information here. Except for the comment itself, all fields are optional!
If you don't want to tells us your name, that's fine. It will be shown as 'anonymous'.
If you want to receive notifications on following comments, naturally you'll have to give us your email address. It will be stored and not be shared with anybody. If you don't want to be notified, just leave the notifications field empty.
If you want your name to be linked to your website, you'll have to give us your site's address. Otherwise leave this field empty.

This data will be stored in case you decide to post a comment here:

  • time and date of your post
  • your name (if supplied)
  • your email (if supplied)
  • your website (if supplied)
  • your comment
  • some technical information unrelated to you, like which blogpost this comment belongs to and a unique id for this comment