The following code is used:
Copy codeThe Code is as follows: <%
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: // 127.0.0.1/Ip1HtmlView. dll # version =, 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.
It is not difficult to prevent Dll downloads. You can add one for IIS. dll ISAPI extension. The action of selecting a Dll file for an executable file is limited to "null". (You can do whatever you want. You can just enter the file without any need .). If the Dll doesn't work for the external site, you can't talk about it. To prevent news from being stolen, check request. ServerVariables ("HTTP_REFERER.
In addition, because I have not graduated from college, I have learned to fight hard, so there must be a lot of junk places. Please leave it blank. Thank you.