shahin
Active Member
I'm trying to get logged-in using vba in yahoo.com but not being able to. I can't really understand what I'm missing here to get a valid response from that site. The one important thing I could notice that while arranging "POST" request it requires such an url: the part of which I'm also sending via "argstring" argument. However, I might be wrong but it seemed to me so. If anybody helps me on this as to how I can get a valid response from that site, i would be very grateful to him.
Site URL= "https://www.yahoo.com/"
There is a text file in the attachment which contains what I've got from the chrome dev tools. I'm afraid I was tracking the right URL to get logged-in, though.
Site URL= "https://www.yahoo.com/"
Code:
Sub yahoo_login()
Const link As String = "https://login.yahoo.com/account/challenge/password?.src=fpctx&.intl=us&.lang=en-US&authMechanism=primary&display=login&yid=shahin.iqbal&dname=shahin.iqbal&done=https%3A%2F%2Fwww.yahoo.com%2F&s=Qg--&sessionIndex=Qg--&c=OaD_g77.2bIVjU5p_lYq3ZtAhKImes9cNmxVpaCsq9.5fF1sYuBwAlaTxMXAHZac7j2CDD8r8EwDtYg19oIuTNbxvysl61f4Dqtbz7.VKc26f6nJCcbfDcfzZMXjUnkF9QEJsVUxiyq8lXCCcqDaA4qy8tL_vw0WMMQ7f42YxZfbdO8qlapWZxQR.f79UqyyN0KdYFujLkWWD85GyHzmx_YKbfr4y9prQFCV5FAioEzfAGJ705njwu0x9uS6RfDQcvkBwDJp.hIuGWXCqnMP6pwPb9zMPXDkdCsAZzwnZrKi.tuqvtr_RsA-~A&crumb=WFKvLRbcxEC&acrumb=NZ00R7FD"
Dim http As New ServerXMLHTTP, html As New HTMLDocument
Dim argstring As String
argstring = ".src=fpctx&.intl=us&.lang=en-US&authMechanism=primary&display=login&yid=shahin.iqbal&dname=shahin.iqbal&done=https%3A%2F%2Fwww.yahoo.com%2F&s=Qg--&sessionIndex=Qg--&c=OaD_g77.2bIVjU5p_lYq3ZtAhKImes9cNmxVpaCsq9.5fF1sYuBwAlaTxMXAHZac7j2CDD8r8EwDtYg19oIuTNbxvysl61f4Dqtbz7.VKc26f6nJCcbfDcfzZMXjUnkF9QEJsVUxiyq8lXCCcqDaA4qy8tL_vw0WMMQ7f42YxZfbdO8qlapWZxQR.f79UqyyN0KdYFujLkWWD85GyHzmx_YKbfr4y9prQFCV5FAioEzfAGJ705njwu0x9uS6RfDQcvkBwDJp.hIuGWXCqnMP6pwPb9zMPXDkdCsAZzwnZrKi.tuqvtr_RsA-~A&crumb=WFKvLRbcxEC&acrumb=NZ00R7FD"
With http
.Open "POST", link, False
.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"
.send argstring
html.body.innerHTML = .responseText
End With
Debug.Print http.responseText
End Sub
There is a text file in the attachment which contains what I've got from the chrome dev tools. I'm afraid I was tracking the right URL to get logged-in, though.
Attachments
Last edited: