-
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.
-
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
-
K. Hopfully I can get this to work with Winsock. (im not using WebBrowser because It works to slow for my pupouses) But Thnx :)