visual c++ - Why No Set-Cookie Header from Yahoo finance (VC++) -
i try cookie , crumb yahoo finance , use cookie/crumb download yahoo historical stock quote. every time try, cannot cookie because there no set-cookie in response header.
here code:
cinternetsession mysession ("mozilla/5.0 (windows nt 5.1) chrome/49.0.2623.112", 1, pre_config_internet_access, null, null, 0); dword dwhttprequestflags = internet_flag_existing_connect | internet_flag_no_auto_redirect | internet_flag_secure | internet_flag_ignore_cert_cn_invalid | internet_flag_ignore_cert_date_invalid; cstring szheaders = _t("user-agent: mozilla/5.0 (windows nt 5.1) chrome/49.0.2623.112"); internet_port nport = internet_default_https_port; chttpconnection* pserver = null; chttpfile* pfile = null; tchar sz [1025]; cstring strservername = "finance.yahoo.com"; pserver = mysession.gethttpconnection(strservername, nport); try { pfile = pserver->openrequest(chttpconnection::http_verb_get, "/quote/msft?p=msft", null, 1, null, "http/1.1", dwhttprequestflags); pfile->sendrequest(szheaders, null, 0); while (pfile->readstring(sz, 1024)) { //...... //........ } cstring rawhead; pfile->queryinfo(http_query_raw_headers_crlf, rawhead, null); }
i didn't see set-cookie @ in raw header. what's wrong code? how cookie yahoo finance mfc? thanks.
Comments
Post a Comment