Expand|Select|Wrap|Line Numbers
- Private Sub CommandButton2_Click()
- Dim strPost As String
- Dim objHTTP, replyTXT As String
- Dim AuthenticationTicket As String
- AuthenticationTicket = ""
- Set objHTTP = CreateObject("Msxml2.ServerXMLHTTP")
- strPost = "http://finance.yahoo.com/d/quotes.csv?s=^IXIC,^NSEI,Reliance.ns,SBIN.ns&f=sl1d1t1c1ohgv&e=.csv"
- 'Get authentication ticket:
- objHTTP.Open "GET", strPost, False
- Call objHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
- objHTTP.send ("login=****.com&passwd=******")
- replyTXT = objHTTP.responseText
- TextBox2 = replyTXT
- End Sub
I want to login to yahoo and get realtime stock data but I did't know how to parse cookies
- Use XmlHttp and send a GET request to the login page ("http://login.yahoo.com/config/login")
- This will return the session cookie that we extract and store
- Using the session cookie we POST the username and password to the processlogin page. now we are logged in. Then download through this url( "http://finance.yahoo.com/d/quotes.csv?s=^IXIC,^NSEI,Reliance.ns,SBIN.ns&f=sl1 d1t1c1ohgv&e=.csv")