部分代码如下: CInternetFile* pFile;
CInternetSession iHttpSession;

INTERNET_PROXY_INFO proxyinfo;
proxyinfo.dwAccessType = INTERNET_OPEN_TYPE_PROXY;
proxyinfo.lpszProxy = g_SysInfo.sProxyCurrent;
proxyinfo.lpszProxyBypass = NULL;
iHttpSession.SetOption(INTERNET_OPTION_PROXY,(LPVOID)&proxyinfo, sizeof(INTERNET_PROXY_INFO)); pFile = NULL; try
{
pFile = (CInternetFile*)iHttpSession.OpenURL("http://www.sina.com", 0, INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_DONT_CACHE, NULL, 0);
................pFile->Read(&buf, len);
.................
无法获取正常的网页内容,问题出在哪里?请帮我看看,多谢!

解决方案 »

  1.   

    CString myData;
       myHttpFile=(CHttpFile*)mySession.OpenURL(url,1,INTERNET_FLAG_DONT_CACHE,NULL,0);
       for(int i=0;i<20&&myHttpFile->ReadString(myData);i++)
       {
       strXMLReturn+=myData+"\r\n"; //因为每次只能读取一行,所以要循环读取数据
       }
      

  2.   

    返回的页面内容:
    <h3> Welcome to the CoDeeN HTTP CDN Service! </h3>You are using CoDeeN content distribution network(CDN).  <a
    href="http://codeen.cs.princeton.edu">CoDeeN</a> is a pulling-based
    HTTP content distribution network(CDN) deployed on <a
    href="http://www.planet-lab.edu">PlanetLab</a> with the goal of
    improving the Web performance.<p> 
    You see this page because you chose to use CoDeeN in some way. If
    you don't want to surf through CoDeeN, please undo whatever step you
    made to use CoDeeN. Please check your proxy setting at your browser,
    or uninstall any anonymizer software which uses CoDeeN. By the way,
    using Web anonymizer through CoDeeN will not work smoothly, and your
    access to CoDeeN get blocked at any time.<p> 
    Finally, please <b>do not attempt to abuse our system</b>. For
    security reasons, we closely monitor all the activities through CoDeeN
    and log all the requests, and in case of abuse these may be used as
    evidence in police investigation.
    ..............是不是我的网络设置有问题啊?