https://foro.gambas-es.org/viewtopic.php?f=1&t=4744&p=27249#p27249
-----------------------------------
vuott
Sabado, 04 Julio 2015, 18:38

Re: Como Saber Si Una URL Es Válida?
-----------------------------------
[quote user="vuott" post="27238"]......una manera un po' cruda y brutal[/quote]

Bueno, vamos a ver una otra cosita un po' más fina.

" [i]Sanctae functiones externae,
  orate pro nobis ![/i] "    [img]http://static.iobloggo.com/static/img/smiley/megmoticons/please.gif[/img]


[code linenumbers=false syntax=gambas]Library "libsnmp:30.0.2"

' struct hostent *gethostbyname(const char *name)
' Returns a structure of type hostent for the given host name.
Private Extern gethostbyname(idn As String) As Pointer


Public Sub Main()

  Dim hos As Pointer
  Dim idn As String

    idn = "www.pythonistas.es"

    hos = gethostbyname(idn)
    If IsNull(hos) Then
      Print "ping: host desconocido";; Quote(idn)
    Else
      Print "Ping: host "; Quote(idn); " valido\n"
      Print "Nombre oficial del host:";; String@(Pointer@(hos))
      Print "Nombre alias:";; String@(Pointer@(Pointer@(hos + 8)))
    Endif

End[/code]


