Trying to open a PDF(-website) with a referer which can only be opened with a link-click on the parents page.
By Using
CreateObject(WinHttp.WinHttpRequest.5.1)
.setRequestHeader "referer", "https://...“
the access works, but I need to open the page in a browser to view the pdf.
Found this:
Syntax: object.Navigate2(URL, Flags, TargetFrameName, PostData, Headers)
(PostData [in, optional] Headers [in, optional])
and tried
Dim IE As InternetExplorer
Set IE = New InternetExplorer
With IE
.Navigate2
https://main...,
"https://referer..."
No results! Does anyone have a solution? (Just VBA please! Thx)
I believe you provided the wrong Referer URL (and wrong format too, you need to also include Referer:
in addition to the Referer URL) to the Headers parameter, try this:
Private Sub Test()
Dim oIE As InternetExplorer
Set oIE = New InternetExplorer
With oIE
.Visible = True
.navigate "https://www.zvg-portal.de/index.php?button=showAnhang&land_abk=ni&file_id=16396&zvg_id=6467", _
headers:="Referer: https://www.zvg-portal.de/index.php?button=showZvg&zvg_id=6467&land_abk=sh"
End With
oIE.Quit
Set oIE = Nothing
End Sub