In a message regarding Re: Reading from an Excel file dated Mon, 5 Jun 2006
15:08:46 +1000, [EMAIL PROTECTED] said that ...

> will be XML web page and getting data from that web page, automated
> because this particular page refreshes very often.
> Each refresh must be checked and any new changes needs to be logged to
> txt file or a database. But a txt file will do initially.

I don't know of any existing program to do exactly what you require but I
can offer a couple of suggestions and a little code, though the code is
only intended as a guide.

If the XML page is intended as a data source, go to the definition and find
out how different items are identified. In that case, it may be worth
trying to parse the XML directly. I don't intend to address that issue as
I'm not very good at it.

If it is intended to be viewed, you'll probably need to open the site in
your browser, view source and work out how each item can be identified.

Then, download the source, using an HTTPSocket and search for the items you
are looking for.

A very simplistic example is pasted below using the only two numbers at
<http://rb.sgarman.net/mynum.php>  I recommend you look at its source in
your browser to help you see how the code works.

In this example, the log is intended to appear on your DeskTop.
This code is designed to go in the Action event of a timer control but I
tested it in a pushButton.

  Dim URL As String = "http://rb.sgarman.net/mynum.php";
  Dim numDelim1 As String = "<span class=""myNumber"">"
  Dim valDelim1 As String = "<span class=""myValue"">"
  Dim delim2 As String = "</span>"
  Dim f As FolderItem = DesktopFolder.Child("mynumLog.txt")
  Dim tos As TextOutputStream
  Dim d As Date

  Static numb As String
  Static valu As String

  Dim NewNumb As String
  Dim NewValu As String

  Dim skt1 As New HTTPSocket
  Dim s As String
  Dim pos1,pos2 As Integer

  s = skt1.Get(URL,30)

  pos1 = InStr(0,s,numDelim1)+len(numDelim1)
  pos2 = InStr(pos1,s,delim2)

  NewNumb = Mid(s,pos1,pos2-pos1)

  pos1 = InStr(pos2,s,valDelim1)+len(valDelim1)
  pos2 = InStr(pos1,s,delim2)

  NewValu = Mid(s,pos1,pos2-pos1)

  If NewNumb <> numb or NewValu <> valu Then
    numb = NewNumb
    valu = NewValu
    If f <> nil Then
      d = new Date
      s = d.SQLDateTime + " " + numb + " " + valu
      tos = f.AppendToTextFile
      tos.WriteLine s
    End If
  End If

--
Steve Garman
Using REALbasic 2006r2 Professional on Windows XP Pro


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to