Hey all, i am using VB6 to check out a forum website and get the text from EACH poster. This is how the HTML is layied out for each posting from each user.
Code:
<tr valign="top">
<td width="175" style="border-right: 1px solid rgb(238, 238, 238); border-left: 1px solid rgb(238, 238, 238); border-width: 0px 1px;
border-style: none solid; border-color: -moz-use-text-color rgb(238, 238, 238);" class="alt2">
<div id="postmenu_4486861">
<a href="http://www.link.org/forum/members/34272.html" class="bigusername" rel="nofollow">Tod Whnner</a>
</div>
<div class="smallfont">Forum Member</div>
<div class="smallfont">
<br>
<div>Join Date: May 2007</div>
<div>Location: Somewhere, GA</div>
<div>Likes: Computers</div>
<div><span id="repdisplay_4486861_34272">
<img border="0" alt="Tod Whnner" src="http://www.link.org/forum/images/reputation/reputation_balance.gif" class="inlineimg"></span></div>
<div class="smallfont">Feedback Score: 1 reviews</div>
<div></div>
</div>
</td>
<td style="border-right: 1px solid rgb(238, 238, 238);" id="td_post_4486861" class="alt1">
<!-- icon and title -->
<div class="smallfont">
<img border="0" alt="Default" src="http://www.link.org/forum/images/icons/icon1.gif" class="inlineimg" title="Default">
<strong>Re: Need help with something</strong>
</div>
<hr size="1" style="color: rgb(238, 238, 238); background-color: rgb(238, 238, 238);">
<!-- / icon and title -->
<!-- message -->
<div id="post_message_4486861">
This is the post where i need to get the text from here
</div>
<!-- / message -->
</td>
</tr>
I am trying to get the users name "Tod Whnner" and "This is the post where i need to get the text from here" from each post but the problem i am runnning into is that each post has a different number for it (ie. post_message_4486861) so i can not go by the div ID and keep moving until it doesnt find one anymore.
The code below was taken from a post here
http://www.xtremevbtalk.com/showpost...50&postcount=5
Code:
Dim strData As String
Dim strForum As String
Dim strStrong As String
Dim strNotStrong As String
Dim strF As String
Dim lngPos As Long
Dim lngPos1 As Long
Dim lngStart As Long
Dim boDone As Boolean
txtResults.Text = ""
strForum = "valign=""top"""
strStrong = "<div id=""post_message_"">"
strNotStrong = "</div>"
strData = Inet1.OpenURL("http://www.link.org/forum/f77/need-local-streamwood-120k-tuneup-expert-please-388717/")
If Inet1.StillExecuting = True Then
Do
Loop Until Inet1.StillExecuting = False
End If
lngStart = 1
Do
'
' Find the next record with "Class = "alt1Active"
' if found, starting from where that ends, look for
' <strong> which marks the start of the Forum Name
' then look for </strong> which marks the end of
' the Forum Name. Move the text between the two
' positions into the textbox.
' Set the search start point to just after the name
' and repeat until we can't find a "Class = "alt1Active"
'
lngPos = InStr(lngStart, strData, strForum)
If lngPos <> 0 Then
lngPos = InStr(lngPos + Len(strForum), strData, strStrong)
If lngPos <> 0 Then
lngPos1 = InStr(lngPos, strData, strNotStrong)
If lngPos1 <> 0 Then
strF = Mid(strData, lngPos + Len(strStrong), lngPos1 - (lngPos + Len(strStrong)))
txtResults.Text = txtResults.Text & strF & vbCrLf
End If
End If
Else
boDone = True
End If
lngStart = lngPos1 + Len(strNotStrong)
Loop Until boDone = True
Any help would be great!
David