Providing authentication info via msxml2.ServerXMLHTTP

前端 未结 2 1017
南笙
南笙 2020-12-03 23:11

I am using Classic ASP and trying to use the JustGiving API.

I\'d like to use it to display the total amount raised, and total donations received on my donation page

2条回答
  •  心在旅途
    2020-12-03 23:46

    Try

    http.Open "GET", vurl, False, "yourusername", "yourpassword"
    

    I don't know if this works on justgiving, but it does with the Bing API

    Also, this question may be relevant XmlHttp Request Basic Authentication Issue

    Edit - using Response.ContentType and Msxml2.ServerXMLHTTP.6.0

    vurl = "https://api.justgiving.com/API_KEY/v1/account"
    Set http = Server.CreateObject("msxml2.ServerXMLHTTP.6.0")
    http.Open "GET", vurl, False, "username", "pwd"
    http.setTimeouts 5000, 5000, 10000, 10000 'ms - resolve, connect, send, receive'
    http.setRequestHeader "Authorization", "Basic MY_AUTH_STRING"
    http.Send
    
    Response.ContentType = "application/xml"    
    
    Set items = http.responseXML.getElementsByTagName("account")
    

    etc

提交回复
热议问题