
Originally Posted by
ppl2pass
thanks does the code extract each string?
also what if this is the reader.
Code:
Dim Request As HttpWebRequest = HttpWebRequest.Create("http://peterpanh4x.nintendolegends.com/forums/index.php?/topic" & Topic4Site)
Dim Response As HttpWebResponse = Request.GetResponse()
Dim reader As StreamReader = New StreamReader(Response.GetResponseStream)
Dim httpContent As String
httpContent = reader.ReadToEnd
---
edit
used your code. didnt work.
Working for me...I think you are doing something wrong...
And there are more than 1 lines of '<div class='post entry-content', so it will catch all. you then need to determine which one should remain on the final string.
Well here's the final code [Tested and working perfectly fine]:
[php]
Sub ReadTag()
Dim Request As HttpWebRequest = HttpWebRequest.Create("http://peterpanh4x.nintendolegends.com/forums/index.php?/topic" & Topic4Site)
Dim Response As HttpWebResponse = Request.GetResponse()
Dim reader As StreamReader = New StreamReader(Response.GetResponseStream)
Dim httpContent As String
httpContent = reader.ReadToEnd
Dim File As String = My.Computer.FileSystem.GetTempFileName() & Rnd() * 777
My.Computer.FileSystem.WriteAllText(File, httpContent, False)
Dim filereader As New IO.StreamReader(File)
Dim extraction As String = ""
Dim flag As Boolean = False
While Not filereader.EndOfStream
Dim CurrentLine As String = filereader.ReadLine()
'No issue if there's a space or not
If CurrentLine.Trim.Contains("<div class='post entry-content") Then
flag = True
Continue While
End If
If CurrentLine.Trim.Contains("</div>") Then
If flag Then
'This will seperate the other tags...so you can recognize them !
extraction += "***************************************" & vbCrLf
End If
flag = False
End If
If flag Then
extraction += CurrentLine & vbCrLf
End If
End While
My.Computer.FileSystem.DeleteFile(File, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently, FileIO.UICancelOption.DoNothing)
extraction = extraction.Trim
MsgBox(extraction)
End Sub
[/php]
I hope this code will work fine on your side too, If not then feel free to ask !!