Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[PHP] Hostname ermitteln

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe eine Variable, die entweder eine IP im Format a.b.c.d oder etwas anderes enthält. nun möchte ich aus der variable (nur wenn sie eine IP enthält) den hostnamen mit gethostbyaddr ermitteln. ich kann ich aber am besten zuvor prüfen ob es sich um eine a.b.c.d IP handelt ?

Danke

Hi

ich würde das mit einem Regulären Ausdruck regeln.

Ich glaube aber das die Funktion gethostbyaddr einen Fehler zurückliefert wenn es keine gültige IP ist.

Dann könntest du es auch so machen:

if (gethostbyaddr($ip) )

{ echo "ERFOLG"; } else { echo "FEHLER "; }

glaub ich zumindest

ciao

r%t

da kommt dann immernoch der fehler:

Warning: Address is not in a.b.c.d form in /usr/local/httpd/htdocs/sapserv_new.php on line 53

Tach,

ich würde per split den string bei punkten splitten lassen,

dann kannst du überprüfen ob ein array mit 4 stellen rauskommt.

kann es leider gerade nicht prüfen, sollte aber klappen.

so long,

MsB

danke, hab mit explode gesplittet !

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.