HTTP GET 请求,ASP - 我迷路了!
将 VBScript 与 ASP 结合使用,我尝试设置一个 HTTP GET 请求,该请求将访问一个页面,该页面又生成一行 ASCII(非 HTML)。然后,我想将 ASCII 行(包含由分号分隔的 4 个值)推断回原始 ASP 页面中的 4 个变量,以便我可以获取这些值并对其进行处理。
这是我想通过 HTTP GET 请求访问的页面 http://www.certigo.com/demo /request.asp。此处三个值均为空。
我对 ASP 了解不多/一无所知,所以我有这个:
Dim oXMLHTTP
Dim strStatusTest
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")
oXMLHTTP.Open "GET", "http://www.certigo.com/demo/request.asp", False
oXMLHTTP.Send
If oXMLHTTP.Status = 200 Then
strStatusText = oXMLHTTP.responseBody
End If
但显然我不知道我在做什么,因为这根本不起作用。如果我得知我所拥有的一切没有朝着正确的方向发展,我一点也不感到惊讶。请帮忙!!
-特蕾西
Using VBScript with ASP I am trying to set up an HTTP GET Request which will visit a page which in turn generates a line of ASCII (non-HTML). I then want to extrapolate that ASCII line which will have 4 values delimited by semicolons back into 4 variables in my original ASP page so that I can take those values and do something with them.
This is the page I want to access with HTTP GET Request http://www.certigo.com/demo/request.asp. Three of the values are null here.
I don't know much/anything about ASP, so I have this:
Dim oXMLHTTP
Dim strStatusTest
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")
oXMLHTTP.Open "GET", "http://www.certigo.com/demo/request.asp", False
oXMLHTTP.Send
If oXMLHTTP.Status = 200 Then
strStatusText = oXMLHTTP.responseBody
End If
but obviously I haven't a clue what I'm doing because this isn't working at all. I would be totally unsurprised to learn that what I have here isn't going in the right direction. Please help!!
-Tracy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的代码应如下所示: -
请注意,在 ASP 中使用 ServerXMLHTTP,XMLHTTP 组件是为客户端使用而设计的,在多线程环境(例如 ASP)中使用并不安全。
Your code should look like this:-
Note use ServerXMLHTTP from within ASP, the XMLHTTP component is designed for client side usage and isn't safe to use in the multithreaded environment such as ASP.
尝试将
oXMLHTTP.responseBody
更改为oXMLHTTP.responseText
并查看是否有效。如果您需要有关此技术的更多信息,请参阅此网页:
http://classicasp.aspfaq.com/general/how-do-i-read-the-contents -of-a-remote-web-page.html。
Try changing the
oXMLHTTP.responseBody
tooXMLHTTP.responseText
and see if that works.Refer to this web page if you need some more information on this technique:
http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html.