On Error Resume Next
Dim oStream, szMsg, szURL
szURL = "http://expert.csdn.net/Expert/topic/3025/3025367.xml?temp=.7882959"
Set x = Server.CreateObject("MSxml2.XMLHTTP")
x.Open "GET",szURL,False
x.send
Set oStream = Server.CreateObject("ADODB.Stream")
oStream.Type = 1
oStream.Open
oStream.Write x.responseBody
oStream.SaveToFile "c:\csdn.asp"
oStream.close

解决方案 »

  1.   

    请问:对象server怎么声明???
      

  2.   

    我要在.htm文件中实现,
    请问还有其它方法没?
      

  3.   

    CString CDownInfoDlg::DownURL(CString strURL)
    {
    CInternetSession m_Session("DigitalTitan");
        CHttpFile* pFile=NULL;
    CException* e; TCHAR szTempPath[MAX_PATH],szTempFile[MAX_PATH];
        DWORD dwResult=::GetTempPath(MAX_PATH,szTempPath);
    CString strURLPath;
    GetTempFileName(szTempPath,_T("DigitalTitan_"),0,szTempFile);
    strURLPath=szTempFile;
        TRY
    {
    pFile=(CHttpFile*)m_Session.OpenURL(strURL);
    }
    CATCH_ALL(e)
    {
    pFile=NULL;
    AfxMessageBox("URL地址不合法",MB_ICONINFORMATION);
    return "";
    }
    END_CATCH_ALL if(pFile)
    {
    DWORD dwStatus;
    DWORD dwBufLen=sizeof(dwStatus);
    BOOL bSuccess=pFile->QueryInfo(HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER,&dwStatus,&dwBufLen);
    if(bSuccess&&dwStatus>=200&&dwStatus<300)
    {
    CStdioFile m_File;
    if(m_File.Open(strURLPath,CFile::modeWrite|CFile::modeCreate|CFile::typeBinary))
    {
    BYTE pBuf[1024];
    DWORD dwRead;
    do
    {
    dwRead=pFile->Read(pBuf,1024);
    m_File.Write(pBuf,dwRead);
    }
    while(dwRead>0);
    m_File.Close();
    }
    }
    pFile->Close();
    delete pFile;
    }
    else
    {
    m_Session.Close();
    }
    return strURLPath;
    }
      

  4.   

    To gjd111686(数字金刚)  
    谢谢你!
    有没有这个例子的网页?