相关疑难解决方法(0)

通过msxml2.ServerXMLHTTP提供身份验证信息

我正在使用Classic ASP并尝试使用JustGiving API.

我想用它在我的网站上显示我捐赠页面上收到的总金额和捐款总额.

我可以通过以下网址查看该信息:https: //api.justgiving.com/docs/resources/v1/Account/Retrieve

<%
vurl = "http://api.justgiving.com/---myIDhere---/v1/account"
Set http = Server.CreateObject("msxml2.ServerXMLHTTP")
http.Open "GET", vurl, False
http.Send

Set dom = Server.CreateObject("msxml2.DOMDocument")

dom.loadXML http.responseText

Set items = dom.getElementsByTagName("account")

For Each item In items

    Set var_totalDonated = item.getElementsByTagName("totalDonated")
    If NOT (var_totalDonated IS Nothing) Then
        var_totalDonated = ap(totalDonated(0).Text)
        response.write var_totalDonated
    End If

Next
%>
Run Code Online (Sandbox Code Playgroud)

但是,当我访问它时页面超时.

我认为这是因为我需要提供一些身份验证信息,如下所示:https: //api.justgiving.com/docs/usage#protectedResources

所以我得到了身份验证信息.

但我不知道如何将它"发送"到API,以便它可以作为用户验证我并提供信息.

它还提到通过上面的链接提供标题信息(我不能发布链接,因为我没有足够的声誉),但用#contentTypes替换URL末尾的#protectedResources.

对不起 - 我还缺少那边的东西吗?

如果我问的是愚蠢的问题,我很抱歉,但是关于API文档的信息假定用户方面有一定程度的智能,而且我没有太多的信息!

任何建议都非常感谢.

谢谢


感谢John的回复.

基于此,我将代码更改为:

<%
vurl = "https://api.justgiving.com/API_KEY/v1/account"
Set http = …
Run Code Online (Sandbox Code Playgroud)

api asp-classic

6
推荐指数
1
解决办法
3万
查看次数

标签 统计

api ×1

asp-classic ×1