0
set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttp.Open "GET", "http://www.yapi.com.tr/Haberler/e_61034.html", false
objXmlHttp.Send
response.write  objXmlHttp.ResponseText

这段代码并没有给我所有的源代码。响应文本直到“Yapı Dergisi, 284”,但 orjinal 页面直到“/body /html”。为什么这发生在我身上?

Orjinal 页面 - http://www.yapi.com.tr/Haberler/e_61034.html

我的代码 - http://www.mekanturu.com/1.asp

4

1 回答 1

0

在原始页面中,主要文章末尾(“284”之后)似乎有一个空字节。似乎 ResponseText 将该空字节视为响应字符串的结尾。我能够通过使用以下内容获得完整的文章:

<%
Response.CharSet = 65001
Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttp.Open "GET", "http://www.yapi.com.tr/Haberler/e_61034.html", false
objXmlHttp.Send
Response.BinaryWrite  objXmlHttp.ResponseBody
%>

请注意,我将响应字符集设置为与原始页面匹配的 UTF-8。

于 2011-08-09T05:12:22.753 回答