{"id":512,"date":"2009-08-25T01:25:36","date_gmt":"2009-08-24T17:25:36","guid":{"rendered":""},"modified":"2014-03-11T22:27:11","modified_gmt":"2014-03-11T14:27:11","slug":"gethttppage%e7%bc%93%e5%ad%98","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2009\/08\/25\/512.htm","title":{"rendered":"gethttppage()\u7f13\u5b58"},"content":{"rendered":"<p>&nbsp;<\/p>\n<div class=\"UBBDiv\">\n<p>[Code]&lt;% <br \/>\nfunction&nbsp;getHTTPPage(url)&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;dim&nbsp;&nbsp;&nbsp;httpxml&nbsp;&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;Set&nbsp;httpxml=&nbsp;server.CreateObject(&quot;msxml2.XMLHTTP&quot;)&nbsp;&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;httpxml.open&nbsp;&quot;get&quot;,url,False <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;httpxml.send() <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;httpxml.readystate&lt;&gt;4&nbsp;then <br \/>\n&nbsp;&nbsp;exit&nbsp;function <br \/>\nend&nbsp;if&nbsp; <br \/>\n&nbsp;&nbsp;getHTTPPage=bytesToBSTR(Httpxml.responseBody,&quot;GB2312&quot;) <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;httpxml=nothing <br \/>\n&nbsp;&nbsp;if&nbsp;err.number&lt;&gt;0&nbsp;then&nbsp;err.Clear <br \/>\n&nbsp;&nbsp;&nbsp;end&nbsp;function&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;&nbsp;2\u3001\u8f6c\u6362\u4e71\u739b\uff0c\u76f4\u63a5\u7528xmlhttp\u8c03\u7528\u6709\u4e2d\u6587\u5b57\u7b26\u7684\u7f51\u9875\u5f97\u5230\u7684\u5c06\u662f\u4e71\u739b\uff0c\u53ef\u4ee5\u901a\u8fc7adodb.stream\u7ec4\u4ef6\u8fdb\u884c\u8f6c\u6362 <br \/>\nFunction&nbsp;BytesToBstr(body,Cset)&nbsp; <br \/>\ndim&nbsp;objstream <br \/>\nset&nbsp;objstream&nbsp;=&nbsp;Server.CreateObject(&quot;adodb.stream&quot;) <br \/>\nobjstream.Type&nbsp;=&nbsp;1 <br \/>\nobjstream.Mode&nbsp;=3 <br \/>\nobjstream.Open <br \/>\nobjstream.Write&nbsp;body <br \/>\nobjstream.Position&nbsp;=&nbsp;0 <br \/>\nobjstream.Type&nbsp;=&nbsp;2 <br \/>\nobjstream.Charset&nbsp;=&nbsp;Cset <br \/>\nBytesToBstr&nbsp;=&nbsp;objstream.ReadText <br \/>\nobjstream.Close <br \/>\nset&nbsp;objstream&nbsp;=&nbsp;nothing <br \/>\nEnd&nbsp;Function <br \/>\n%&gt;[\/Code]<\/p>\n<\/div>\n<p>\u4e0a\u9762\u7684\u4ee3\u7801\u5728\u4ee3\u7801\u7b2c\u4e8c\u6b21\u751f\u6210\u7684\u65f6\u5019\u4e0d\u4f1a\u66f4\u65b0\uff0c\u4e0b\u9762\u7684\u4ee3\u7801\u52a0\u4e0a\u65f6\u95f4\u5c31\u597d\u4e86\uff01<\/p>\n<div class=\"UBBDiv\">\n<p>[Code]&lt;% <br \/>\nfunction&nbsp;getHTTPPage(byval&nbsp;url)&nbsp; <br \/>\n&nbsp;&nbsp;if&nbsp;instr(url,&quot;?&quot;)&gt;0&nbsp;then <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;url=url&amp;&quot;&amp;d=&quot;&amp;now()&nbsp; <br \/>\n&nbsp;&nbsp;else <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;url=url&amp;&quot;?d=&quot;&amp;now() <br \/>\n&nbsp;&nbsp;end&nbsp;if <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;dim&nbsp;&nbsp;&nbsp;httpxml&nbsp;&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;Set&nbsp;httpxml=&nbsp;server.CreateObject(&quot;msxml2.XMLHTTP&quot;)&nbsp;&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;httpxml.open&nbsp;&quot;get&quot;,url,False <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;httpxml.send() <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;httpxml.readystate&lt;&gt;4&nbsp;then <br \/>\n&nbsp;&nbsp;exit&nbsp;function <br \/>\nend&nbsp;if&nbsp; <br \/>\n&nbsp;&nbsp;getHTTPPage=bytesToBSTR(Httpxml.responseBody,&quot;GB2312&quot;) <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;httpxml=nothing <br \/>\n&nbsp;&nbsp;if&nbsp;err.number&lt;&gt;0&nbsp;then&nbsp;err.Clear <br \/>\n&nbsp;&nbsp;&nbsp;end&nbsp;function&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;&nbsp;2\u3001\u8f6c\u6362\u4e71\u739b\uff0c\u76f4\u63a5\u7528xmlhttp\u8c03\u7528\u6709\u4e2d\u6587\u5b57\u7b26\u7684\u7f51\u9875\u5f97\u5230\u7684\u5c06\u662f\u4e71\u739b\uff0c\u53ef\u4ee5\u901a\u8fc7adodb.stream\u7ec4\u4ef6\u8fdb\u884c\u8f6c\u6362 <br \/>\nFunction&nbsp;BytesToBstr(body,Cset)&nbsp; <br \/>\ndim&nbsp;objstream <br \/>\nset&nbsp;objstream&nbsp;=&nbsp;Server.CreateObject(&quot;adodb.stream&quot;) <br \/>\nobjstream.Type&nbsp;=&nbsp;1 <br \/>\nobjstream.Mode&nbsp;=3 <br \/>\nobjstream.Open <br \/>\nobjstream.Write&nbsp;body <br \/>\nobjstream.Position&nbsp;=&nbsp;0 <br \/>\nobjstream.Type&nbsp;=&nbsp;2 <br \/>\nobjstream.Charset&nbsp;=&nbsp;Cset <br \/>\nBytesToBstr&nbsp;=&nbsp;objstream.ReadText <br \/>\nobjstream.Close <br \/>\nset&nbsp;objstream&nbsp;=&nbsp;nothing <br \/>\nEnd&nbsp;Function <br \/>\n%&gt; <br \/>\n[\/Code]<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; [Code]&lt;% function&nbsp;getHTTPPage(url)&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;dim&nbsp;&nbsp;&nbsp;httpxml&nbsp;&nbsp;&#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-512","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/512","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=512"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/512\/revisions"}],"predecessor-version":[{"id":66372,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/512\/revisions\/66372"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=512"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=512"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}