Announcement

Collapse
No announcement yet.

[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 4, 2006, 02:12 PM.
Working...
X