我怎样才能张贴在ASP中使用的经典卷曲数据? [英] How can I post data using cURL in asp classic?
问题描述
我怎样才能从发布 order.asp
数据,第三方网址?
How can I post data from order.asp
to 3rd party url?
我在表单标签的所有参数。
I have all parameters in form tag.
在提交第三方要我补充两个值作为标题。第三方code是如下
On submission 3rd party want me to add two values as header. 3rd party code is as below
curl https://www.instamojo.com/api/1.1/payment-requests/ \
--header "X-Api-Key: [API_KEY]" \
--header "X-Auth-Token: [AUTH_TOKEN]" \
--data
"allow_repeated_payments=False&amount=2500&buyer_name=John+Doe&purpose=FIFA+16&redirect_url=http%3A%2F%2Fwww.example.com%2Fredirect%2F&phone=9999999999&send_email=True&webhook=http%3A%2F%2Fwww.example.com%2Fwebhook%2F&send_sms=True&email=foo%40example.com"
我使用ASP经典。我可以用 response.AddHeader名称,值
来传递这两个值 X-API-键
和 X-验证令牌
?
如果不能,那么如何在ASP中使用的经典卷发?
If not possible, then how to use curl in asp classic?
推荐答案
您可以用这样做的<一个href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/aa384106%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396\"相对=nofollow> WinHtt prequest 对象
<%
Dim http: Set http = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
Dim url: url = "https://www.instamojo.com/api/1.1/payment-requests/"
Dim data: data = "allow_repeated_payments=False&amount=2500&buyer_name=John+Doe&purpose=FIFA+16&redirect_url=http%3A%2F%2Fwww.example.com%2Fredirect%2F&phone=9999999999&send_email=True&webhook=http%3A%2F%2Fwww.example.com%2Fwebhook%2F&send_sms=True&email=foo%40example.com"
With http
Call .Open("POST", url, False)
Call .SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
Call .SetRequestHeader("X-Api-Key", "yourvalue")
Call .SetRequestHeader("X-Auth-Token", "yourvalue")
Call .Send(data)
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
%>
这仅仅是一个硬codeD例如,通常你会通过某些方法而不是传递一个硬codeD字符串构建数据
变量。
This is just a hard-coded example, usually you would build the data
variable via some method rather then passing a hard-coded string.
Response.AddHeader()
经典ASP是用来设置HTTP头时,服务器发送一个响应返回给客户端。
Response.AddHeader()
is used in Classic ASP to set HTTP headers being returned to the client when the server is sending a response.
在这种情况下ASP页是客户端在这种情况下,你不会用发送到另一台服务器的请求,以便 Response.AddHeader
但 SetRequestHeader()
的 WinHtt prequest
对象的方法,而不是。
In this scenario the ASP page is the client sending a request to another server so in this context you wouldn't use Response.AddHeader
but the SetRequestHeader()
method of the WinHttpRequest
object instead.
这篇关于我怎样才能张贴在ASP中使用的经典卷曲数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!