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

首頁 > 編程 > ASP > 正文

asp中利用xmlhttp抓取網頁內容的代碼_ASP教程

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

推薦:asp xmlhttp下載一句話
asp中通過xmlhttp下載一句話代碼,需要的朋友可以參考下

需要分件html源代碼
此例中的被抓取的html源代碼如下
<p align=left>2004年8月24日星期二;白天:晴有時多云南風3―4級;夜間:晴南風3―4級;氣溫:最高29℃最低19℃ </p>
而程序中是從
以2004年8月24日為關鍵字搜索,直到</p>結速
而抓取的內容就變成了"2004年8月24日星期二;白天:晴有時多云南風3―4級;夜間:晴南風3―4級;氣溫:最高29℃最低19℃ "
干干凈凈的了。記錄一下。

復制代碼 代碼如下:www.CuoXIn.com

<%
On Error Resume Next
Server.ScriptTimeOut=9999999
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
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function
%>
<html>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 MARGINHEIGHT=0 MARGINWIDTH=0>
<!-- 開始 -->
<%
Dim wstr,str,url,start,over,dtime
dtime=Year(Date)&"年"&Month(Date)&"月"&Day(Date)&"日"
url="http://www.CuoXIn.com/"
wstr=getHTTPPage(url)
start=Newstring(wstr,dtime)
over=Newstring(wstr,"</p>")
body=mid(wstr,start,over-start)
response.write "<MARQUEE onmouseover=this.stop(); onmouseout=this.start();>"&body&"</marquee>"

%>
<!-- 結束 -->
</body></html>

分享:asp中將有雙引號標題入庫的方法
asp中將有雙引號標題入庫的方法,需要的朋友可以參考下

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沅江市| 余姚市| 岳普湖县| 梧州市| 湖口县| 吉安县| 丹东市| 昆明市| 德庆县| 洛扎县| 米林县| 页游| 玉田县| 朝阳县| 建平县| 尼木县| 松潘县| 临高县| 遂昌县| 麻江县| 湖口县| 定边县| 沛县| 比如县| 格尔木市| 孝感市| 巴林左旗| 类乌齐县| 且末县| 临沭县| 大英县| 房产| 梅河口市| 舞钢市| 达州市| 茶陵县| 灌阳县| 南昌市| 陇川县| 大渡口区| 仁寿县|