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

首頁 > 編程 > ASP > 正文

提供幾個關于采集的函數(ASP)

2024-05-04 11:07:50
字體:
來源:轉載
供稿:網友

<%
''''''''''''''''斷劍注釋'''''''''''''''''''''''''
''''strText為要切取內容的那段打的內容''''''''''''
''''strStarTag為要切取內容的開始的地方''''''''''
''''strEndTag為要切取內容的結束的地方''''''''''
''''GetText返回值為切取出來的內容''''''''''''''
'''''''''''''''注釋結束''''''''''''''''''''''''
Function GetText(strText, strStartTag, strEndTag)
dim intStart
intStart = instr(strText, strStartTag)
if intStart then
intStart = intStart + len(strStartTag)
intEnd = InStr(intStart, strText, strEndTag)
GetText = Mid(strText, intStart, intEnd - intStart)
else
GetText = " "
end if
End Function

%>
<%
'''''''''斷劍注釋''''''''''''
'''''''''以下的函數都可以不管'''''''''
''''''''只管入口函數getHTTPPage'''''''
''''''''path為要讀取的網頁地址''''''''
''''''''getHTTPPage返回讀取到的網頁內容''
''''''''這里應該注意的是gb2312這里,如果被讀取的網頁編碼是
''gb2312就用gb2312,如果是UTF-8的話,就換成UTF-8''''
''''''''注釋結束''''''''''
Function getHTTPPage(Path) 
t = GetBody(Path) 
getHTTPPage=BytesToBstr(t,"gb2312") 
End function

Function GetBody(url) 
on error resume next 
Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
With Retrieval 
.Open "get", url, False, "", "" 
.Send 
GetBody = .ResponseBody 
End With 
Set Retrieval = Nothing 
End Function
Function BytesToBstr(body,Cset) 
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
%>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 昭平县| 甘南县| 涞水县| 洮南市| 郧西县| 和龙市| 广丰县| 沧源| 石首市| 湘潭市| 安宁市| 阳城县| 汾西县| 固镇县| 莱州市| 云和县| 理塘县| 岳阳市| 明水县| 宜君县| 将乐县| 扎囊县| 娄烦县| 保康县| 焉耆| 汤原县| 祥云县| 桃园县| 嫩江县| 浦江县| 漯河市| 罗山县| 通海县| 南召县| 吉水县| 中西区| 肇州县| 洞口县| 鹰潭市| 灵武市| 五常市|