不知道是不是htpps的原因 ,我试着访问其他的http地址都可以,请各路大神指教一下
我访问的 地址是:https://jy.yongjinbao.com.cn/winner_gj/gjzq/stock/exchange.action?CSRF_Token=undefined×tamp=0.5404199283897542&request_id=mystock_405
代码如下:
AfxParseURL(strUrl, dwServiceType, strServer, strObject, nPort);
if(AFX_INET_SERVICE_HTTP != dwServiceType && AFX_INET_SERVICE_HTTPS != dwServiceType)
{
return FAILURE;
}
try
{
m_pConnection = m_pSession->GetHttpConnection(strServer,
dwServiceType == AFX_INET_SERVICE_HTTP ? NORMAL_CONNECT : SECURE_CONNECT,
nPort);
m_pFile = m_pConnection->OpenRequest(strMethod, strObject,
NULL, 1, NULL, NULL,
dwServiceType == AFX_INET_SERVICE_HTTP ? NORMAL_REQUEST : SECURE_REQUEST
);
m_pFile = m_pConnection->OpenRequest(strMethod, strObject,
NULL, 1, NULL, NULL,
INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_NO_COOKIES);
m_pFile->AddRequestHeaders(_T("Accept: */*"));
m_pFile->AddRequestHeaders(_T("Referer: https://jy.yongjinbao.com.cn/winner_gj/gjzq/stock/mystock.html"));
m_pFile->AddRequestHeaders(_T("Accept-Language: zh-CN"));
m_pFile->AddRequestHeaders(_T("Accept-Encoding: gzip,deflate"));
m_pFile->AddRequestHeaders(_T("User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)"));
m_pFile->AddRequestHeaders(_T("Host: jy.yongjinbao.com.cn"));
m_pFile->AddRequestHeaders(_T("DNT: 1"));
m_pFile->AddRequestHeaders(_T("Connection: keep-alive"));
BOOL ret = m_pFile->SendRequest(NULL, 0, (LPVOID)(LPCTSTR)strPostData, strPostData == NULL ? 0 : _tcslen(strPostData));
------解决思路----------------------
这个ID代表服务器返回无效或无法识别的响应。你的HTTP请求不能被服务器完全或正确译解,请求可能已被传输错误破坏。尝试在Web浏览器中重新加载文档以纠正问题
应该还是你的请求数据,格式有问题。
------解决思路----------------------
网卡选错了。我猜。