本帖最后由 VisualEleven 于 2012-01-19 11:45:16 编辑

解决方案 »

  1.   

    CHttpFile* pFile = CInternetSession::OpenURL();
    然后调用
    CHttpFile::QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF,...)简单例子代码:try
    {
    CInternetSession session(_T("Session"));
    CHttpFile* pFile = (CHttpFile*)session.OpenURL(_T("http://www.google.com"));
    if(pFile)
    {
    CString str(_T(""));
    pFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF, str);
    AfxMessageBox(str);
    pFile->Close();
    delete pFile;
    pFile = NULL;
    }
    session.Close();
    }
    catch (CException* e)
    {
    e->ReportError();
    e->Delete();
    }
      

  2.   


    这个获得的是头部的信息我想要的是返回的body的内容额 
    HTTP_QUERY_RAW_HEADERS_CRLF 这个参数换哪个
      

  3.   

    http://msdn.microsoft.com/zh-cn/ms906347
    求大神指引啊这里哪个是。。
      

  4.   

    我用的是window api 没有MFC的封装类,贴一个获取(请求或者响应)头信息函数,一般在请求结束,获取正文前使用——
    CString GetHead(HINTERNET hRequest, BOOL requestOrResponse)
    {
    DWORD dwInfoLevel;
    if(requestOrResponse)
    dwInfoLevel = HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS;
    else
    dwInfoLevel = HTTP_QUERY_RAW_HEADERS_CRLF; DWORD headLength;
    ::HttpQueryInfo(hRequest,
    dwInfoLevel
    ,NULL,&headLength,NULL);
    char* headData = new char[headLength+1];
    ::HttpQueryInfo(hRequest,
    dwInfoLevel
    ,headData,&headLength,NULL);
    headData[headLength] = '\0';
    CString strCookie = headData;
    if(headData)
    {
    delete headData;
    headData = NULL;
    }
    return strCookie;
    }
    {"count":2,"data".........
    这是返回的文本信息,查一下InternetReadFileEx怎么用吧。
      

  5.   

    http://topic.csdn.net/t/20030331/17/1600384.html
      

  6.   

    已经解决!
    那里不能用httpqueryinfo这样InternetReadFile( FilesUrl, szTemp, sizeof(szTemp),&dwSize);
    然后对其进行gzip解压
    具体方法网上都函数
    OK~!!