How to send an HTTP post with a custom header using REBOL
我一直在尝试使用该站点的API使用REBOL访问该站点,但是我遇到了问题。 API调用需要一个自定义标头和一个XML格式的请求。我一直在尝试读取/自定义,但是我不确定如何包括标头或应采用的格式。 system / options / cgi中的默认标头是一个对象,因此我认为它应该是一个对象,但是您将它放在哪里? (添加到system / options / cgi无效。)
我猜下面的代码就像我需要的...
1 2 3 4 5 6 7 8 9 10 11 12 13 | http-custom-header: make object! [ Content-Type: text/xml etc... ] xml-request: { <?xml version="1.0" encoding="utf-8"?> <etc>etc...<etc> } site-URL: http://etc... response: read/custom site-URL reduce ['post xml-request] |
由于http-custom-header尚未放置在任何有用的地方,因此这将无法工作。
我在正确的Rails上吗?如果是这样,标题应该放在哪里?否则,使用REBOL发送HTML标头和请求的可行方法是什么?
我知道了。您只需将'header和一个块(不是对象)添加到读取/自定义块中。因此...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | http-custom-header: [ Content-Type: text/xml etc... ] xml-request: { <?xml version="1.0" encoding="utf-8"?> <etc>etc...<etc> } site-URL: http://etc... response: read/custom site-URL reduce [ 'header http-custom-header 'post xml-request ] |