Results 1 to 3 of 3

Thread: finding unknown

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Posts
    96

    Question finding unknown

    K im making a project with winsock in it. And I want to know how you go about and find data within data. what im using it for is getting a web page title. I want to be able to say like

    If DataArrived = blah + <title> + blah2 + </title> then
    form1.caption = blah2

    See what I want to be able to do is find out stuff inbetween the title.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    is this any help?
    Code:
    Option Explicit
    Option Compare Text
    
    Private Sub Command3_Click()
    Dim strTitle As String
    Dim strTemp As String
    
    strTemp = "<HTML><HEAD><TITLE>Mark Sreeves</TITLE></HEAD><BODY></BODY></HTML>"
    
    strTitle = GetStuffBetween(strTemp, "<title>", "</title>")
    
    End Sub
    Private Function GetStuffBetween(strIn As String, OpeningTag As String, ClosingTag As String) As String
    Dim i As Integer
    Dim j As Integer
    i = InStr(strIn, OpeningTag)
    j = InStr(strIn, ClosingTag)
    
    
    If (i > 0) And (j > 0) Then
        i = i + Len(OpeningTag)
        GetStuffBetween = Mid(strIn, i, j - i)
    Else
        'decide for your self what you want to do if a tag is missing!
    End If
    End Function

    if you were using a webbrowser control you could do this:
    Code:
    Private Sub WebBrowser1_TitleChange(ByVal Text As String)
    Form1.Caption = WebBrowser1.Document.Title
    End Sub
    Mark
    -------------------

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Posts
    96
    K. Hopfully I can get this to work with Winsock. (im not using WebBrowser because It works to slow for my pupouses) But Thnx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width