MSXML2. ServerXMLHTTP ResponseText Get incomplete content, solution

Source: Internet
Author: User

Today there is no intention of discovering a problem, there are several pages using MSXML2. ServerXMLHTTP get the page source code,. ResponseText always returns part of the content and cannot get the full content.

After searching, find the solution: use. Responsebody (reference: http://blog.links.cn/asp/aspxmlhttp.html)

However, from the reference article, his problem is not exactly the same as mine, when I test, just replace the responsetext to Responsebody, the problem is solved .

The reference article also mentions a bug in ADODB.stream that requires Chr (0) to be replaced with ""

' HttpGet = Xmlhttp.responsetext
HttpGet = replace (Bytestobstr (xmlhttp.responsebody, "Utf-8"), chr (0), "")

' bytes are converted into characters according to the specified encoding
Function Bytestobstr (Body,cset)
Dim objstream
Set objstream = Server.CreateObject ("ADODB.stream")
Objstream. Type = 1
Objstream. Mode =3
Objstream. Open
Objstream. Write Body
Objstream. Position = 0
Objstream. Type = 2
Objstream. Charset = Cset
Bytestobstr = objstream. ReadText
Objstream. Close
Set objstream = Nothing
End Function

MSXML2. ServerXMLHTTP ResponseText Get incomplete content, solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.