天天看點

怎麼用ASP擷取一個網頁的HTML代碼

< DOCTYPE html PUBLIC -WCDTD XHTML StrictEN httpwwwworgTRxhtmlDTDxhtml-strictdtd>

Private   Function   bytes2BSTR(vIn)   '字元串函數   

  Dim   i,   ThischrCode,   NextchrCode   

  strReturn   =   ""   

  For   i   =   1   To   LenB(vIn)   

  ThischrCode   =   AscB(MidB(vIn,   i,   1))   

  If   ThischrCode   <   &H80   Then   

  strReturn   =   strReturn   &   Chr(ThischrCode)   

  Else   

  NextchrCode   =   AscB(MidB(vIn,   i   +   1,   1))   

  strReturn   =   strReturn   &   Chr(CLng(ThischrCode)   *   &H100   +   CInt(NextchrCode))   

  i   =   i   +   1   

  End   If   

  Next   

          bytes2BSTR   =   strReturn   

  End   Function   

  Function   GetURL(url)     '字元方式的xmlhttp   

          Set   Retrieval   =   Server.CreateObject("Microsoft.XMLHTTP")   

                      With   Retrieval   

                      .Open   "post",   url,   False,   "",   ""   

                      .Send   

                      GetURL   =   .ResponseText   

      GetURL   =   bytes2BSTR(.Responsebody)   

                      End   With   

          Set   Retrieval   =   Nothing   

  用的時候這樣   

  strs就是得到的源碼  

本文轉自 netcorner 部落格園部落格,原文連結:http://www.cnblogs.com/netcorner/archive/2006/12/22/2912456.html  ,如需轉載請自行聯系原作者

繼續閱讀