What VBA code is required to perform an HTTP POST from an Excel spreadsheet?
相关问题
- Angular RxJS mergeMap types
- HTML form is not sending $_POST values
- Excel sunburst chart: Some labels missing
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- 请大神帮忙 post向https接口发送数据 部署到服务器为什么运行一会后就会报空指针
- WCF发布Windows服务 POST方式报错 GET方式没有问题 应该怎么解决?
- 用 $.ajax POST 请求数据报错
- 设备发送一个http post请求,接收不到
- Is a unicode user agent legal inside an HTTP heade
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
If you need it to work on both Mac and Windows, you can use QueryTables:
Notes:
For more details, you can see my full summary about "using web services from Excel."
In addition to the anwser of Bill the Lizard:
Most of the backends parse the raw post data. In PHP for example, you will have an array $_POST in which individual variables within the post data will be stored. In this case you have to use an additional header "Content-type: application/x-www-form-urlencoded":
Otherwise you have to read the raw post data on the variable "$HTTP_RAW_POST_DATA".
I did this before using the MSXML library and then using the XMLHttpRequest object. See http://scriptorium.serve-it.nl/view.php?sid=40
Alternatively, for greater control over the HTTP request you can use
WinHttp.WinHttpRequest.5.1
in place ofMSXML2.ServerXMLHTTP
.You can use ServerXMLHTTP in a VBA project by adding a reference to MSXML.
(from Referencing MSXML within VBA Projects)
The ServerXMLHTTP MSDN documentation has full details about all the properties and methods of ServerXMLHTTP.
In short though, it works basically like this: