有人可以帮我从下面的CURL请求创建经典的asp代码吗?在经典的ASP CURL请求
curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/beshared-repos/"
我试过下面的示例代码,但它没有工作。
Dim http: Set http = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
Dim url: url = "https://cloud.seafile.com/api2/beshared-repos/"
Dim data: data = "token=f2210dacd9c6ccb8133606d94ff8e61d99b477fd"
With http
Call .Open("GET", url, False)
Call .SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
Call .SetRequestHeader("Authorization", "Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd")
Call .Send()
End With
If Left(http.Status, 1) = 2 Then
'Request succeeded with a HTTP 2xx response, do something...
Else
'Output error
Call Response.Write("Server returned: " & http.Status & " " & http.StatusText)
End If
而且它抛出在行Call.Send()
WinHttp.WinHttpRequest error '80090326'
The message received was unexpected or badly formatted.
[Documentation](https://manual.seafile.com/develop/web_api.html#shared-libraries)供参考。 – Lankymart
[看起来像我的代码](https://stackoverflow.com/a/37462944/692942)。它绝对有效,所以如果你得到一个错误,可能是因为你没有传递正确的“Content-Type”或缺少一些要求。 – Lankymart