利用xmlHTTP获取网页源码[asp]

< %
' 利用xmlHTTP获取网页源码
strScriptCurrentDirectory  =   " http:// " & request.serverVariables( " SERVER_NAME " ) & " : " & request.serverVariables( " SERVER_PORT " )_
 
& request.serverVariables( " SCRIPT_NAME " )
strScriptCurrentDirectory 
=   left (strScriptCurrentDirectory, len (strScriptCurrentDirectory) - len ( split (strScriptCurrentDirectory, " / " )( ubound ( split (strScriptCurrentDirectory, " / " )))))

Function  funGetHTTPPage(priStrPath,priStrMothed)
    priT 
=  funGetBody(priStrPath,priStrMothed)
    funGetHTTPPage 
=  funBytesToBstr(priT,  " GB2312 " )
End Function

Function  funGetBody(priStrUrl,priStrMothed)
    
' On Error Resume Next
     Set  Retrieval  =   CreateObject ( " Microsoft.XMLHTTP " )
    
With  Retrieval
        .Open priStrMothed, priStrUrl, 
False "" ""
        .Send
        funGetBody 
=  .ResponseBody
    
End   With
    
Set  Retrieval  =   Nothing
End Function

Function  funBytesToBstr(priBody, priCSet)
    
Set  objStream  =  Server.CreateObject( " adodb.stream " )
    objStream.Type 
=   1
    objStream.Mode 
=   3
    objStream.Open
    objStream.Write priBody
    objStream.Position 
=   0
    objStream.Type 
=   2
    objStream.CharSet 
=  priCSet
    funBytesToBstr 
=  objStream.ReadText
    objStream.Close
    
Set  objStream  =   Nothing
End Function
%
>

你可能感兴趣的:(xmlhttp)