|
The following code is used:
<%
On Error resume next
Dim objxmlhttp, XML
Set xml = server. Createobject ("Microsoft. XMLHTTP ")
XML. Open "get", "http://chanye.finance.sina.com.cn/yj/2005-01-05/236914.shtml", false
XML. Send
Tmpstr = xml. responsetext
Ep = clng (instr (1, tmpstr, "meta_data2") + 18
Tmpstr = Replace (tmpstr, vbcrlf ,"")
Tmpstr = Replace (tmpstr, CHR (9 ),"")
Tmpstr = Replace (tmpstr, CHR (32 ),"")
Mydata = mid (tmpstr, 1, EP)
Recfilen = server. mappath ("tempstr.txt ")
Set astream = server. Createobject ("ADODB. Stream ")
Astream. type = 2
Astream. mode = 3
Astream. Open
Astream. charset = "gb2312"
Astream. Position = 0
Astream. writetext mydata, 1
Astream. savetofile recfilen, 2
Astream. Close
Set astream1 = server. Createobject ("ADODB. Stream ")
Astream1.type = 2
Astream1.mode = 3
Astream1.charset = "gb2312"
Astream1.open
Astream1.loadfromfile (recfilen)
ASSP = astream1.size
Crttmpstr = astream1.readtext (ASSP)
Astream1.close
SP1 = clng (instr (1, crttmpstr, "meta_data1") + 16
EP1 = clng (instr (SP1, crttmpstr, "name = meta_data2")-7
Lth1 = ep1-sp1
Newdata = mid (crttmpstr, SP1, lth1)
%>
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Style>
Body {
Font-size: 12px
}
TD {
Font-size: 12px
}
</Style>
<Title> obtain DLL-encrypted news content using ASP </title>
<Table width = "540" border = "0" align = "center" cellpadding = "0" cellspacing = "0">
<Tr>
<TD> Update Time: <% = now %> length of retrieved content: <% = lth1 %>
Bytes
Note that http: // 127.0.0.1/ip1htmlview. dll must be downloaded first ?!
<Object ID = htmlip1view codebase = http://image2.sina.com.cn/cj/chanye/Ip1HtmlView.dll#version=1,0,1,14 classid = CLSID: D854FC15-D3EA-496A-B2A0-A772A3DE1D09>
<Param name = "meta_data1" value = "<% = newdata %>">
<Param name = "meta_data2" value = "">
<Param name = "meta_data3" value = "">
<Param name = "meta_data4" value = "">
<Param name = "meta_data5" value = "">
<Param name = "meta_data6" value = "">
<Param name = "meta_data7" value = "">
<Param name = "meta_data8" value = "">
<Param name = "baseurl" value = "111">
<Param name = "random" value = "111">
</Object> </TD>
</Tr>
</Table>
</Body>
</Html> |
| Code Description: the reason for using ADODB. stream, because the directly obtained content is always unable to achieve the desired effect, the EP position is always much longer than expected, and I tried to use limit B, functions such as midb also get confusing results, so I had to make the best effort and look at it with high fingers (alas, how do I feel sour ). Of course, it is only effective for the current location. You can modify other settings, or even directly generate pages and record them to the database to become your own. It should be enough to write the database with the above. |