快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

大灰狼的ASP工具箱??XMLHTTP的应用,获得远程的文件,获得远程HTML文件源码

获得远程的文件

response.write getHTTPPage("http://www.csdn.net")

function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function

Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function


--------------------------------------------------------------------

获得远程HTML文件源码

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body>
<div id="demo"> <div style="width: 677; height: 70">

</body>

</html>
<script language=vbscript>
sub b3_onclick
Dim objXMLHTTP, xml
Set xml = CreateObject("Microsoft.XMLHTTP")

xml.Open "GET", "http://192.168.8.15:7001/wap_manage/login.asp", False
\\\' Pull the data from the web page
xml.Send
\\\'demo.innerhtml= xml.responseText
\\\'demo.innertext= xml.responseText
demo.innertext= bytes2BSTR(xml.responsebody)
Set xml = Nothing
end sub

sub d1_select

end sub

Function bytes2BSTR(vIn)
Dim strReturn
Dim I, ThisCharCode, NextCharCode
strReturn = ""
For I = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn, I, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn, I + 1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
I = I + 1
End If
Next
bytes2BSTR = strReturn
End Function

</script>
<input type="button" value="获取html源码" name="B3">
返回类别: 教程
上一教程: 有关站内模糊查询的源程序
下一教程: ASP实现K线图(在线)

您可以阅读与"大灰狼的ASP工具箱??XMLHTTP的应用,获得远程的文件,获得远程HTML文件源码"相关的教程:
· 大灰狼的ASP工具箱??自动获得远程图片
· 大灰狼的ASP工具箱??用ASP读INI配置文件的函数
· 大灰狼的ASP工具箱??CDONTS和JMAIL的使用
· 大灰狼的ASP工具箱??ASP的错误集合
· 大灰狼的ASP工具箱??防盗链、判定星期几
    微笑服务 优质保证 索取样品