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

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

问题描述

使用与ASP我试图建立一个HTTP GET请求,将访问一个页面而这又产生一个线ASCII(非HTML)的VBScript。那么我想推断出ASCII行,将有由分号分隔4个值回我原来的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!!

-Tracy

推荐答案

您code应该是这样的: -

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天全站免登陆