»ñȡԶ³ÌÍøÒ³htmlÔ´Âë
''' <summary>
''' »ñÈ¡ÍøÒ³htmlÔ´Âë¡£
''' </summary>
''' <param name="AUrl"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function GetHtml(ByVal AUrl As String, ByVal APageCode As System.Text.Encoding) As String
Dim httpReq As System.Net.HttpWebRequest = Nothing
Dim httpResp As System.Net.HttpWebResponse = Nothing
Dim httpURL As New System.Uri(AUrl)
Dim reader As IO.StreamReader = Nothing
Dim htmlStr As String = String.Empty
Try
httpReq = CType(Net.WebRequest.Create(httpURL), Net.HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), Net.HttpWebResponse)
reader = New IO.StreamReader(httpResp.GetResponseStream, APageCode)
htmlStr = reader.ReadToEnd()
Catch ex As Exception
Finally
If Not IsNothing(reader) Then reader.Close()
If Not IsNothing(httpResp) Then httpResp.Close()
End Try
Return htmlStr
End Function
Ïà¹ØÎĵµ£º
³¬Îı¾±ê¼ÇÓïÑÔ£¨HTML£©5 µÚÒ»´ÎÏò HTML ÖÐÒýÈëеÄÔªËØ¡£ÐÂµÄ½á¹¹ÔªËØ°üÀ¨ aside¡¢figure ºÍ section¡£ÐµÄÄÚÁªÔªËذüÀ¨ time¡¢meter ºÍ progress¡£ÐµÄÄÚÇ¶ÔªËØÓÐ video ºÍ audio¡£ÐµĽ»»¥ÔªËØÓÐ details¡¢datagrid ºÍ command¡£
¡¡¡¡³¬Îı¾±ê¼ÇÓïÑÔ£¨HTML£©µÄ¿ª·¢µ½ ......
string str = a.ToString();
str = Regex.Replace(str, @"</?span[^>]*>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"&#[^>]*;", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"</?marquee[^>]*>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, ......
<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//ÔÚÕâÀïÈç¹ûд³É“WEB-INF\templates\template.htm”³ÌÐò»á±¨´í
String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm"; &nbs ......
WEB·þÎñÆ÷¿Ø¼þÊÇHTML¿Ø¼þµÄÒ»ÖÖÀ©Õ¹,Çø±ðÊÇ:
1)ǰÕß¿ÉÒÔ´¥·¢·þÎñÆ÷¿Ø¼þÌØÓеÄʼþ£¬ºóÕßÖ»ÄÜͨ¹ý»ØµÝµÄ·½Ê½´¥·¢·þÎñÆ÷ÉϵÄÒ³Ãæ¼¶Ê¼þ¡£
2)ÊäÈ뵽ǰÕßÖеÄÊý¾ÝÔÚÇëÇóÖ®¼ä¿ÉÒÔά»¤£¨¼´¾ßÓÐ״̬¹ÜÀí¹¦ÄÜ£©,¶øºóÕßÎÞ·¨×Ô¶¯Î¬»¤Êý¾Ý£¬Ö»ÄÜʹÓÃÒ³Ãæ¼¶µÄ½Å±¾À´±£´æºÍ»Ö¸´¡£
3)ǰÕß¿ÉÒÔ×Ô¶¯¼ì²âä¯ÀÀÆ÷²¢µ÷Õûµ½Ç¡µ±µÄÏÔʾ£¬¶øº ......