HTTP GET 请求,ASP - 我迷路了! [英] HTTP GET Request, ASP - I'm lost!

查看:36
本文介绍了HTTP GET 请求,ASP - 我迷路了!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 ASP 中使用 VBScript 我试图设置一个 HTTP GET 请求,该请求将访问一个页面,该页面反过来生成一行 ASCII(非 HTML).然后,我想将包含 4 个以分号分隔的值的 ASCII 行外推回原始 ASP 页面中的 4 个变量,以便我可以获取这些值并对其进行处理.

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.

这是我想使用 HTTP GET 请求访问的页面 http://www.certigo.com/demo/request.asp.其中三个值在这里为空.

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.

我对 ASP 了解不多/一无所知,所以我有这个:

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!!

-特蕾西

推荐答案

你的代码应该是这样的:-

Your code should look like this:-

Function GetTextFromUrl(url)

  Dim oXMLHTTP
  Dim strStatusTest

  Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")

  oXMLHTTP.Open "GET", url, False
  oXMLHTTP.Send

  If oXMLHTTP.Status = 200 Then

    GetTextFromUrl = oXMLHTTP.responseText

  End If

End Function

Dim sResult : sResult = GetTextFromUrl("http://www.certigo.com/demo/request.asp")

注意在 ASP 中使用 ServerXMLHTTP,XMLHTTP 组件是为客户端使用而设计的,在 ASP 等多线程环境中使用并不安全.

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.

这篇关于HTTP GET 请求,ASP - 我迷路了!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆