shahin
Active Member
Hi there! Running my script to parse some data from a site, I could notice that it does fetch info from certain pages where data are embedded nicely but when i try to get the links for the next pages i got stuck. Because, it fetches numbers, as in 1,2,3 instead of href. Any help would be highly appreciated. Code for both the working and befuddling one.
Code:
Sub ArchitectInfo()
Dim http As New MSXML2.XMLHTTP60
Dim html As New HTMLDocument
Dim items As Object, item As Object, post As Object
Dim things As Object, thing As Object
PostData = "action=show_search_result&action_spam=dDfgEr&txtSearchType=5&txtPracName=&optSstate=3&optRegions=23&txtPcode=&txtShowBuildingType=0&optBuildingType=1&optHomeType=1&optBudget="
With http
.Open "POST", "http://www.findanarchitect.com.au/index.php", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send PostData
html.body.innerHTML = .responseText
End With
Set items = html.getElementsByClassName("clearboth")
For Each item In items
Set post = item.getElementsByTagName("h2")
If post.Length Then
x = x + 1
Cells(x, 1) = post(0).innerText
End If
Next item
'Set things = html.getElementById("pagination").getElementsByTagName("a")
' For Each thing In things
' x = x + 1
' Cells(x, 1) = thing.innerText
' Next thing
End Sub