{"id":766,"date":"2011-11-18T00:05:05","date_gmt":"2011-11-17T16:05:05","guid":{"rendered":""},"modified":"2014-03-11T22:40:49","modified_gmt":"2014-03-11T14:40:49","slug":"asp%e9%87%87%e9%9b%86html%e5%86%85%e5%ae%b9%e5%8e%9f%e7%90%86%e5%8f%8a%e5%b8%b8%e7%94%a8%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2011\/11\/18\/766.htm","title":{"rendered":"asp\u91c7\u96c6HTML\u5185\u5bb9\u539f\u7406\u53ca\u5e38\u7528\u4ee3\u7801"},"content":{"rendered":"<p>html\u5185\u5bb9\u91c7\u96c6\u65b9\u4fbf\u4e86\u4e0d\u5c11\u65b0\u7ad9\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u4e00\u4e0b\u5982\u4f55\u91c7\u96c6\uff0c\u539f\u7406\u662f\u4ec0\u4e48\uff0c\u5e76\u9644\u4e0a\u5e38\u7528\u4ee3\u7801\u3002\u5148\u8bf4\u4e00\u4e0b\u91c7\u96c6\u539f\u7406\uff1a<\/p>\n<p>\u91c7\u96c6\u7a0b\u5e8f\u7684\u4e3b\u8981\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<p>\u4e00\u3001\u83b7\u53d6\u88ab\u91c7\u96c6\u7684\u9875\u9762\u7684\u5185\u5bb9 <br \/>\n\u4e8c\u3001\u4ece\u83b7\u53d6\u4ee3\u7801\u4e2d\u63d0\u53d6\u6240\u6709\u7528\u7684\u6570\u636e<\/p>\n<p>\u4e00\u3001\u83b7\u53d6\u88ab\u91c7\u96c6\u7684\u9875\u9762\u7684\u5185\u5bb9<\/p>\n<p>\u6211\u76ee\u524d\u6240\u638c\u63e1\u7684ASP\u5e38\u7528\u83b7\u53d6\u88ab\u91c7\u96c6\u7684\u9875\u9762\u7684\u5185\u5bb9\u65b9\u6cd5\uff1a<\/p>\n<p>1\u3001\u7528serverXMLHTTP\u7ec4\u4ef6\u83b7\u53d6\u6570\u636e<\/p>\n<p>&nbsp;\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p>Function GetBody(weburl) <br \/>\n&#8216;\u521b\u5efa\u5bf9\u8c61 <br \/>\nDim ObjXMLHTTP <br \/>\nSet ObjXMLHTTP=Server.CreateObject(&quot;MSXML2.serverXMLHTTP&quot;) <br \/>\n&#8216;\u8bf7\u6c42\u6587\u4ef6,\u4ee5\u5f02\u6b65\u5f62\u5f0f <br \/>\nObjXMLHTTP.Open &quot;GET&quot;,weburl,False <br \/>\nObjXMLHTTP.send <br \/>\nWhile ObjXMLHTTP.readyState &lt;&gt; 4 <br \/>\nObjXMLHTTP.waitForResponse 1000 <br \/>\nWend <br \/>\n&#8216;\u5f97\u5230\u7ed3\u679c <br \/>\nGetBody=ObjXMLHTTP.responseBody <br \/>\n&#8216;\u91ca\u653e\u5bf9\u8c61 <br \/>\nSet ObjXMLHTTP=Nothing <br \/>\nEnd Function <br \/>\n\u8c03\u7528\u65b9\u6cd5\uff1a <br \/>\nGetBody(\u6587\u4ef6\u7684URLf\u5730\u5740)<\/p>\n<p>\n2\u3001\u6216XMLHTTP\u7ec4\u4ef6\u83b7\u53d6\u6570\u636e<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p>Function GetBody(weburl) <br \/>\n&#8216;\u521b\u5efa\u5bf9\u8c61 <br \/>\nSet Retrieval = CreateObject(&quot;Microsoft.XMLHTTP&quot;) <br \/>\nWith Retrieval <br \/>\n.Open &quot;Get&quot;, weburl, False, &quot;&quot;, &quot;&quot; <br \/>\n.Send <br \/>\nGetBody = .ResponseBody <br \/>\nEnd With <br \/>\n&#8216;\u91ca\u653e\u5bf9\u8c61 <br \/>\nSet Retrieval = Nothing <br \/>\nEnd Function<\/p>\n<p>\n\u8c03\u7528\u65b9\u6cd5\uff1a <br \/>\nGetBody(\u6587\u4ef6\u7684URLf\u5730\u5740)<\/p>\n<p>\u8fd9\u6837\u83b7\u53d6\u7684\u6570\u636e\u5185\u5bb9\u8fd8\u9700\u8981\u8fdb\u884c\u7f16\u7801\u8f6c\u6362\u624d\u53ef\u4ee5\u4f7f\u7528<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p>Function BytesToBstr(body,Cset) <br \/>\ndim objstream <br \/>\nset objstream = Server.CreateObject(&quot;adodb.stream&quot;) <br \/>\nobjstream.Type = 1 <br \/>\nobjstream.Mode =3 <br \/>\nobjstream.Open <br \/>\nobjstream.Write body <br \/>\nobjstream.Position = 0 <br \/>\nobjstream.Type = 2 <br \/>\nobjstream.Charset = Cset <br \/>\nBytesToBstr = objstream.ReadText <br \/>\nobjstream.Close <br \/>\nset objstream = nothing <br \/>\nEnd Function<\/p>\n<p>\n\u8c03\u7528\u65b9\u6cd5\uff1aBytesToBstr(\u8981\u8f6c\u6362\u7684\u6570\u636e,\u7f16\u7801)&#8217;\u7f16\u7801\u5e38\u7528\u4e3aGB2312\u548cUTF-8 <br \/>\n\u4e8c\u3001\u4ece\u83b7\u53d6\u4ee3\u7801\u4e2d\u63d0\u53d6\u6240\u6709\u7528\u7684\u6570\u636e <br \/>\n\u76ee\u524d\u6211\u638c\u63e1\u7684\u65b9\u6cd5\u6709\uff1a <br \/>\n1\u3001\u7528ASP\u5185\u7f6e\u7684MID\u51fd\u6570\u622a\u53d6\u9700\u8981\u7684\u6570\u636e<\/p>\n<p>&nbsp;\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p>Function body(wstr,start,over) <br \/>\nstart=Newstring(wstr,start) <br \/>\n&#8216;\u8bbe\u7f6e\u9700\u8981\u5904\u7406\u7684\u6570\u636e\u7684\u552f\u4e00\u7684\u5f00\u59cb\u6807\u8bb0 <br \/>\nover=Newstring(wstr,over) <br \/>\n&#8216;\u548cstart\u76f8\u5bf9\u5e94\u7684\u5c31\u662f\u9700\u8981\u5904\u7406\u7684\u6570\u636e\u7684\u552f\u4e00\u7684\u7ed3\u675f\u6807\u8bb0 <br \/>\nbody=mid(wstr,start,over-start) <br \/>\n&#8216;\u8bbe\u7f6e\u663e\u793a\u9875\u9762\u7684\u8303\u56f4 <br \/>\nEnd Function<\/p>\n<p>\u8c03\u7528\u65b9\u6cd5\uff1abody(\u88ab\u91c7\u96c6\u7684\u9875\u9762\u7684\u5185\u5bb9,\u5f00\u59cb\u6807\u8bb0,\u7ed3\u675f\u6807\u8bb0) <br \/>\n2\u3001\u7528\u6b63\u5219\u83b7\u53d6\u9700\u8981\u7684\u6570\u636e<\/p>\n<p>&nbsp;\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p>Function body(wstr,start,over) <br \/>\nSet xiaoqi = New Regexp&#8217;\u8bbe\u7f6e\u914d\u7f6e\u5bf9\u8c61 <br \/>\nxiaoqi.IgnoreCase = True&#8217;\u5ffd\u7565\u5927\u5c0f\u5199 <br \/>\nxiaoqi.Global = True&#8217;\u8bbe\u7f6e\u4e3a\u5168\u6587\u641c\u7d22 <br \/>\nxiaoqi.Pattern = &quot;&rdquo;&amp;start&amp;&ldquo;.+?&rdquo;&amp;over&amp;&ldquo;&quot;&#8217;\u6b63\u5219\u8868\u8fbe\u5f0f <br \/>\nSet Matches =xiaoqi.Execute(wstr)&#8217;\u5f00\u59cb\u6267\u884c\u914d\u7f6e <br \/>\nset xiaoqi=nothing <br \/>\nbody=&quot;&quot; <br \/>\nFor Each Match in Matches <br \/>\nbody=body&amp;Match.Value &#8216;\u5faa\u73af\u5339\u914d <br \/>\nNext <br \/>\nEnd Function<\/p>\n<p>\n\u8c03\u7528\u65b9\u6cd5\uff1abody(\u88ab\u91c7\u96c6\u7684\u9875\u9762\u7684\u5185\u5bb9,\u5f00\u59cb\u6807\u8bb0,\u7ed3\u675f\u6807\u8bb0) <br \/>\n\u91c7\u96c6\u7a0b\u5e8f\u7965\u7ec6\u601d\u8def\uff1a <br \/>\n1\u3001\u53d6\u5f97\u7f51\u7ad9\u7684\u5206\u9875\u5217\u8868\u9875\u7684\u6bcf\u9875\u5730\u5740 <br \/>\n\u76ee\u524d\u7edd\u5927\u90e8\u5206\u52a8\u6001\u7f51\u7ad9\u7684\u5206\u9875\u5730\u5740\u90fd\u6709\u89c4\u5219\uff0c\u5982: <br \/>\n\u52a8\u6001\u9875 <br \/>\n\u7b2c\u4e00\u9875\uff1aindex.asp?page=1 <br \/>\n\u7b2c\u4e8c\u9875\uff1aindex.asp?page=2 <br \/>\n\u7b2c\u4e09\u9875\uff1aindex.asp?page=3 <br \/>\n&#8230;..<\/p>\n<p>\u9759\u6001\u9875 <br \/>\n\u7b2c\u4e00\u9875\uff1apage_1.htm <br \/>\n\u7b2c\u4e8c\u9875\uff1apage_2.htm <br \/>\n\u7b2c\u4e09\u9875\uff1apage_3.htm <br \/>\n&#8230;.. <br \/>\n\u53d6\u5f97\u7f51\u7ad9\u7684\u5206\u9875\u5217\u8868\u9875\u7684\u6bcf\u9875\u5730\u5740\uff0c\u53ea\u9700\u8981\u7528\u53d8\u91cf\u66ff\u4ee3\u6bcf\u9875\u5730\u5740\u7684\u53d8\u5316\u7684\u5b57\u7b26\u5373\u53ef\u5982\uff1apage_&lt;%=&quot;&amp;page&amp;&quot;%&gt;.htm<\/p>\n<p>2\u3001\u83b7\u53d6\u88ab\u91c7\u96c6\u7f51\u7ad9\u7684\u5206\u9875\u5217\u8868\u9875\u5185\u5bb9 <br \/>\n3\u3001\u4ece\u5206\u9875\u5217\u8868\u4ee3\u7801\u4e2d\u63d0\u53d6\u88ab\u91c7\u96c6\u7684\u5185\u5bb9\u9875\u9762\u7684URL\u8fde\u63a5\u5730\u5740 <br \/>\n\u7edd\u5927\u90e8\u5206\u5206\u9875\u9875\u9762\u91cc\u7684\u5185\u5bb9\u9875\u8fde\u63a5\u4e5f\u6709\u56fa\u5b9a\u89c4\u5219\uff0c\u5982\uff1a <br \/>\n&lt;a href=&quot;url1&quot;&gt;\u8fde\u63a51&lt;\/a&gt; &lt;br&gt; <br \/>\n&lt;a href=&quot;url2&quot;&gt;\u8fde\u63a52&lt;\/a&gt; &lt;br&gt; <br \/>\n&lt;a href=&quot;url3&quot;&gt;\u8fde\u63a53&lt;\/a&gt; &lt;br&gt;<\/p>\n<p>\u7528\u4ee5\u4e0b\u4ee3\u7801\u5c31\u53ef\u4ee5\u83b7\u5f97\u4e00\u4e2aURL\u8fde\u63a5\u96c6\u5408<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p>Set xiaoqi = New Regexp <br \/>\nxiaoqi.IgnoreCase = True <br \/>\nxiaoqi.Global = True <br \/>\nxiaoqi.Pattern = &rdquo;&rdquo;&ldquo;.+?&rdquo;&ldquo;&ldquo; <br \/>\nSet Matches =xiaoqi.Execute(\u9875\u9762\u5217\u8868\u5185\u5bb9) <br \/>\nset xiaoqi=nothing <br \/>\nurl=&quot;&quot; <br \/>\nFor Each Match in Matches <br \/>\nurl=url&amp;Match.Value <br \/>\nNext<\/p>\n<p>\n4\u3001\u53d6\u5f97\u88ab\u91c7\u96c6\u7684\u5185\u5bb9\u9875\u9762\u5185\u5bb9\uff0c\u6839\u636e&rdquo;\u63d0\u53d6\u6807\u8bb0&ldquo;\u4ece\u88ab\u91c7\u96c6\u7684\u5185\u5bb9\u9875\u9762\u5206\u522b\u622a\u53d6\u8981\u53d6\u5f97\u7684\u6570\u636e<\/p>\n<p>\u56e0\u4e3a\u662f\u52a8\u6001\u751f\u6210\u7684\u9875\u9762\uff0c\u5927\u591a\u6570\u5185\u5bb9\u9875\u9762\u5185\u90fd\u6709\u76f8\u540c\u7684html\u6807\u8bb0\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u8fd9\u4e9b\u6709\u89c4\u5219\u7684\u6807\u8bb0\u63d0\u53d6\u9700\u8981\u7684\u5404\u4e2a\u90e8\u5206\u7684\u5185\u5bb9\u3002 <br \/>\n\u5982\uff1a <br \/>\n\u6bcf\u4e2a\u9875\u9762\u90fd\u6709\u7f51\u9875\u6807\u9898&lt;title&gt;\u7f51\u9875\u6807\u9898&lt;\/title&gt;\uff0c\u7528\u6211\u4e0a\u9762\u5199\u7684MID\u622a\u53d6\u51fd\u6570\u5c31\u53ef\u4ee5\u83b7\u5f97&lt;title&gt;&lt;\/title&gt;\u4e4b\u95f4\u7684\u503c\uff0c\u4e5f\u53ef\u4ee5\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u83b7\u5f97\u3002 <br \/>\n\u4f8b\uff1abody(&quot;&lt;title&gt;\u7f51\u9875\u6807\u9898&lt;\/title&gt;&quot;,&quot;&lt;title&gt;&quot;,&quot;&lt;\/title&gt;&quot;) <br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>html\u5185\u5bb9\u91c7\u96c6\u65b9\u4fbf\u4e86\u4e0d\u5c11\u65b0\u7ad9\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u4e00\u4e0b\u5982\u4f55\u91c7\u96c6\uff0c\u539f\u7406\u662f\u4ec0\u4e48\uff0c\u5e76\u9644\u4e0a\u5e38\u7528\u4ee3\u7801\u3002\u5148\u8bf4\u4e00\u4e0b\u91c7\u96c6\u539f\u7406\uff1a \u91c7\u96c6\u7a0b\u5e8f\u7684\u4e3b\u8981\u6b65\u9aa4\u5982\u4e0b\uff1a \u4e00\u3001\u83b7\u53d6\u88ab\u91c7\u96c6\u7684\u9875\u9762\u7684\u5185\u5bb9 \u4e8c\u3001\u4ece\u83b7\u53d6\u4ee3\u7801\u4e2d\u63d0\u53d6\u6240\u6709\u7528\u7684\u6570\u636e \u4e00\u3001\u83b7\u53d6\u88ab\u91c7\u96c6\u7684\u9875\u9762\u7684\u5185\u5bb9 \u6211\u76ee\u524d\u6240\u638c\u63e1\u7684ASP\u5e38&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-766","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=766"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/766\/revisions"}],"predecessor-version":[{"id":66635,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/766\/revisions\/66635"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=766"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=766"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}