Announcement

Collapse

Contacting HomeSeer This Week

HomeSeer is open and operational this week. All orders are being processed and shipped as usual. However, some staff are working from home. If you need to contact HomeSeer for support or customer service, please use our Email or Chat options. https://homeseer.com/contact-us/
See more
See less

[VB.net Script] Get your ip

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [VB.net Script] Get your ip

    getmyip seems to be not working lately. So, I wrote this simple vb script to get ip & post the htm file to your host page.


    'Code starts here
    Dim getHost As String = "www.edpsciences.com"
    Dim getPage As String = "/htbin/ipaddress"
    Dim getStripTags As Boolean = False
    Dim getPort As Integer = 80

    Dim putHost As String = "your host name" ' something like "upload.comcast.net"
    Dim putUserName As String = "youruserid"
    Dim putPassword As String = "yourftppassword"
    Dim putCommand As String = "put"
    Dim putPath As String = ""
    Dim putLocalFile As String = "ip.htm"
    Dim putRemoteFile As String = "ip.htm"

    Sub Main(parm as object)
    Dim content As String = hs.GetURL(getHost, getPage, getStripTags, getPort)
    'hs.WriteLog("GETIP", content)

    Dim sr As System.IO.StreamReader = New System.IO.StreamReader(putLocalFile)
    Dim oldContent As String = sr.ReadToEnd()
    sr.Close()
    'hs.WriteLog("GETIP", "oldContent = " & oldContent)

    Dim sw As System.IO.StreamWriter = System.IO.File.CreateText(putLocalFile)

    sw.Write(content)
    sw.Flush()
    sw.Close()

    If String.Compare(oldContent, content) <> 0
    hs.WriteLog("GETIP", "ftp new ip")
    hs.ftp(putHost, putUserName, putPassword, putCommand, putPath, putLocalFile, putRemoteFile)
    End If
    End Sub
    Last edited by Rupp; August 4th, 2006, 02:12 PM.
Working...
X