I need to extract the ‘href’ from the html code of this website that is public and without any login:
(To access the page via xmlhttp, it needs a REFERER, that is posted as REFSTRING)
Public Website
All my codes have failed, so I made the following attempt:
Function CheckIfAccess()
Dim html As MSHTML.HTMLDocument, xhr As Object, Headers As Variant
URL As String, RefString As String, CountItems As Long
Set html = New MSHTML.HTMLDocument
Set xhr = CreateObject("MSXML2.ServerXMLHTTP.6.0")
URL = "https://www.zvg-portal.de/index.php?button=showZvg&zvg_id=5972&land_abk=br"
RefString = "https://www.zvg-portal.de/index.php?button=Suchen"
With xhr
.Open "POST", URL, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send RefString
html.body.innerHTML = .responseText
End With
CountItems = html.querySelectorAll("a").length
MsgBox (CountItems)
End Function
The Messegabox always shows ZERO, So the code can not even determine the number of ‘a’.
The thing is that exactly this code worked in the past perfectly:
GetHref = html.querySelectorAll(“a”).Item(x).innerText
…but now suddenly no longer!
Is there any blocking in HTML code or does my code need to be adjusted?
Thanks!