Fetching webpage source when the response is different in logged in and logged out state

让人想犯罪 __ 提交于 2019-12-12 03:38:39

问题


With my code (given below), I capture source of my website's webpage and then I am trying to find a string with InStr and process it with Split. Everything is working but I have an issue where I need help.

When I am logged in to my website supplying the username and password, I can see the string in the webpage source but when I am in a logged out state, my string is not visible in the webpage source. What changes do I need in the code which will tell the computer that I am logged in.

Is this a cache/cookies issue? if yes, how to code it so that it honors the browser cache/cookies remembering that the user is logged in and gets the source as it shows up in logged in state?

Appreciate a reply. Thanks

Sub source()
    Dim oHttp As New WinHttp.WinHttpRequest
    Dim sURL As String
    Dim webpageSource As String
    sURL = "http://www.google.com"
    oHttp.Open "GET", sURL, False
    oHttp.send
    webpageSource = oHttp.ResponseText
End Sub

来源:https://stackoverflow.com/questions/33030951/fetching-webpage-source-when-the-response-is-different-in-logged-in-and-logged-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!