Many people in the net said to the whole station to the static program but most of them did not result, so little sister with a smattering of writing this code would like to have an understanding of ASP transfer static technology
quote:<%
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
%>
Xmlhttp.asp
quote:<!--#include file= "xmlhttp.asp"-->
<%
Url= "co.asp?id=2,"
Wb_cx=pcmane (URL)
IF wb_cx<> "" THEN
RESPONSE. Write ("Start converting static process")
Fso_wstr=split (Wb_cx, ",")
For i=0 to UBound (FSO_WSTR)-1
Qman_html_min= (THHS (THHS) (Fso_wstr (i), "?", "~"), ". asp", "" "&". html ")
Qman_html_min=gethttppage (Http&fso_wstr (i))
For j=0 to UBound (FSO_WSTR)-1
QMAN_HTML_MIN=THHS (Qman_html_min,fso_wstr (j), THHS (THHS (Fso_wstr (j), "?", "~"), ". asp", "" ") &". html ")
QMAN_HTML_MIN=THHS (Qman_html_min, ".html&", ". html?")
Next
Set FSO = Server.CreateObject ("Scripting.FileSystemObject")
FilePath = Server.MapPath (Qman_html_url)
Set fout = fso. CreateTextFile (FilePath)
qman_html_min=qman_html_min& "<script type= ' Text/javascript ' >" &_
' if (!document.location.search = = ') ' &_
"{" &_
"Var h=location.href;" &_
"Var r=new RegExp (' [^\\?] * * ([^&]*) ', ' I '); &_
"Var t=h.match (R);" &_
"if (t)" &_
"{" &_
"var str = t[1];" &_
"Newstr=str.replace ('. html? ', ' & ');" &_
"location=newstr+ '. html ';" &_
"}" &_
"}" &_
"</script>"
Fout. WriteLine Qman_html_min
NEXT
Else
Response. Write ("no Success")
End IF
function Pcmane (URL)
Dim Arrid
Arrid =formateorderby (Arrid&url)
http= "http://www.gong-z.com/"
Dg_split=split (Arrid, ",")
For i=0 to Ubound (dg_split)-1
Dg_href= "< (a href=) [\w].+?>"
Dg_wstr_1=dg_wstr_1&striphtml (">", striphtml ("<a href=", Regexptest (dg_href,gethttppage Split (i))))
Next
If Len (Arrid) =len (Formateorderby (dg_wstr_1)) Then
Pcmane=formateorderby (dg_wstr_1)
Exit function
Else
Arrid=pcmane (dg_wstr_1)
End If
Pcmane = Formateorderby (Arrid)
End Function
Function Formateorderby (Orderbytext)
Dim Tmp,tmp2,i,j
Tmp3= ""
TMP = Split (Orderbytext, ",")
For i=0 to Ubound (TMP)-1
For j=i+1 to Ubound (TMP)
If UCase (Trim (TMP (i))) =ucase (Trim (TMP (j))) Then
TMP (j) = ""
End If
Next
Next
Tmp2= ""
For i=0 to Ubound (TMP)
IF tmp (i) <> "" Then tmp2=tmp2&tmp (i) & ","
Next
Formateorderby=left (Tmp2,len (TMP2))
End Function
' Regular function
Function regexptest (PATRN, STRNG)
Dim regEx, Match, Matches
Set regEx = New RegExp
Regex.pattern = patrn
Regex.ignorecase = True
Regex.global = True
Set matches = Regex.execute (strng)
For the Match in matches
Retstr = retstr & match.value& ","
Next
Regexptest = Retstr
End Function
Function striphtml (patrn,strhtml)
Dim objRegExp, Stroutput
Set objRegExp = New Regexp
Objregexp.ignorecase = True
Objregexp.global = True
Objregexp.pattern =patrn
Stroutput = Objregexp.replace (strHTML, "")
striphtml = Stroutput
Set objRegExp = Nothing
End Function
%>