国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

asp通用采集函數冗余版可以保存文件到本地

2024-05-04 11:01:08
字體:
來源:轉載
供稿:網友
<%
'名稱:asp通用采集函數冗余版,要精品版的有心人自己改
'作者:柳永法
'日期:2007-6-23
Function getHTTPPage(Path)
    t = GetBody(Path)
    getHTTPPage = BytesToBstr(t, "GB2312")
End Function

Function GetBody(url)
    On Error Resume Next
    Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
    With xmlhttp
        .Open "Get", url, False, "", ""
        .Send
        .waitForResponse 1000
        GetBody = .ResponseBody
    End With
    Set xmlhttp = Nothing
End Function

Function BytesToBstr(Body, Cset)
    On Error Resume Next
    Dim objstream
    Set objstream = Server.CreateObject("adodb.stream")
    objstream.Type = 1
    objstream.Mode = 3
    objstream.Open
    objstream.Write Body
    objstream.Position = 0
    objstream.Type = 2
    objstream.Charset = Cset
    BytesToBstr = objstream.ReadText
    objstream.Close
    Set objstream = Nothing
End Function

Function getHTTPimg(url)
    On Error Resume Next
    Dim xmlhttp
    Set xmlhttp = server.CreateObject("MSXML2.XMLHTTP")
    xmlhttp.Open "GET", url, false
    xmlhttp.send()
    If xmlhttp.Status<>200 Then Exit Function
    getHTTPimg = xmlhttp.responseBody
    Set xmlhttp = Nothing
    If Err.Number<>0 Then Err.Clear
End Function

Function Save2Local(from, tofile)
    Dim geturl, objStream, imgs
    geturl = Trim(from)
    imgs = gethttpimg(geturl)
    Set objStream = Server.CreateObject("ADODB.Stream")
    objStream.Type = 1
    objStream.Open
    objstream.Write imgs
    objstream.SaveToFile tofile, 2
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 睢宁县| 阿拉善右旗| 耒阳市| 特克斯县| 钦州市| 桐庐县| 松阳县| 远安县| 平定县| 广德县| 谢通门县| 卓资县| 苏尼特左旗| 天峨县| 新乡市| 资源县| 杂多县| 柳州市| 庆安县| 竹北市| 潜江市| 金华市| 吉木萨尔县| 仁怀市| 巴东县| 宜兰县| 邢台县| 东阳市| 乌兰察布市| 祁东县| 化州市| 英超| 芜湖市| 洮南市| 嘉祥县| 满洲里市| 永春县| 苏尼特右旗| 江川县| 福州市| 沾化县|