ASP.NET实现HTTP方式获取功能

来源:互联网 发布:0基础cpa 知乎 编辑:程序博客网 时间:2024/06/01 10:23
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
me="System.HTTP://www.66of.com" target=_blank>NET" %>
<%@ Import Namespace="System.HTTP://www.66of.com" target=_blank>NET" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
dim STRtemp as string
Sub Page_Load(Src As Object, E As EventArgs)
Dim HTTPWResp as HTTPWebresponse
Dim sr As StreamReader
'dim STRtemp as string
dim build as new stringbuilder

HTTPWReq = WebRequestFactory.Create("HTTP://www.funinspace.com")
HTTPWReq.KeepAlive = false
HTTPWResp = HTTPWReq.GetResponse()
sr = new StreamReader(HTTPWResp.GetResponseStream(), Encoding.ASCII)

Try
line=sr.ReadLine()
lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
build.append (lineENC)

do while not IsNothing(line)
line = sr.ReadLine()
lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
build.append (lineENC)
loop
Catch ex As Exception
problem.text =ex.Message
End Try

labelscrape.text=build.ToString()
End Sub
</script>
<html><head>
<title>Scraping A Website</title>
</head>
<body bgcolor="#FFFFFF">
<h3><font face="Verdana">Scraped Data</font></h3>
<HTTP://www.66of.com" target=_blank>ASP:label id=problem runat="server"/>

<font face="courier new" size="2">
<HTTP://www.66of.com" target=_blank>ASP:label id=labelscrape runat="server"/>
</font>
</body></html>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击