[英]download xml file from url using winhttp in excel - CHARSET=UTF-8
I am trying to automate downloading of xml file from a url. 我正在尝试自动从URL下载xml文件。 Even after multiple attempts I couldn't think of possible solution to this and wonder if anyone could help me by just looking at the output and response header, url being sensitive.
即使经过多次尝试,我也无法想到可能的解决方案,并且想知道是否有人可以通过查看输出和响应标头(URL敏感)来帮助我。
Using the excel I am doing a http request via winhttp to the url and in the response.body its giving the ouput which I can't figure out how to read and get the data out of it. 使用Excel,我通过winhttp到URL和response.body发出了一个http请求,给出了输出,我无法弄清楚如何读取数据并从中获取数据。
Request header 请求标头
url = "https://***sensitive***.com/psc/FS91PRD/EMPLOYEE/ERP/q/?ICQryName=W_GL_INTL_JNLS&ICDummy=1186278907"
With http
.Open "POST", url, False
.setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
.setRequestHeader "Referer", "https://***sensitive***_GL_INTL_JNLS&ICDummy=1186278907"
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "Accept-Encoding", "gzip, deflate"
.setRequestHeader "Host", "***sensitive****"
'.setRequestHeader "Content-Length", "360"
.setRequestHeader "Connection", "keep-alive"
.setRequestHeader "cache-Control", "no-cache"
.setRequestHeader "Cookie", cookie2
.send postData
.waitForResponse
End With
End If
Debug.Print http.getAllResponseHeaders
Response header 响应头
Date: Sun, 24 May 2015 14:03:13 GMT
Content-Length: 10673
Content-Type: text/html; CHARSET=UTF-8
Content-Encoding: gzip
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Set-Cookie: PS_TOKENEXPIRE=24_May_2015_14:03:13_GMT;
IgnorePortalRegisteredURL: 1
PortalRegisteredURL: https://***sensitive***.com/
UsesPortalRelativeURL: true
X-Powered-By: Servlet/2.5 JSP/2.1
Output String 输出字符串
See the Content-Encoding: gzip
? 请参阅
Content-Encoding: gzip
? You need to decompress the body using gzip, or use a client library that will do it for you. 您需要使用gzip解压缩主体,或者使用将为您完成工作的客户端库。
Just as a side note, though, if the server sent you a gzipped response when you didn't send Accept-Encoding: gzip
, there's something wrong with it. 不过,作为旁注,如果服务器在您未发送
Accept-Encoding: gzip
向您发送了gzip压缩响应,则可能出了点问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.