【发布时间】:2012-02-06 14:12:59
【问题描述】:
我在 excel 2010 中通过 vba 使用 xmlhttp。我需要以编程方式将商品添加到网站上的购物车中。到目前为止,我有下面的代码,它使用POST 方法
我认为我的代码有一些问题,但不知道如何解决 - 它没有显示提交的表单在哪里。这是那个网址:
http://www.craft-e-corner.com/p-2688-new-testament-cricut-cartridge.aspx
我作为处理表单的 url 输入的 url 是“表单”的“action=”部分中的 url。
如何验证表单是否已发布?
Sub post_frm()
Dim xmlhttp As Object
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
' Indicate that page that will receive the request and the
' type of request being submitted
xmlhttp.Open "POST", "http://www.craft-e-corner.com/addtocart.aspx?returnurl=showproduct.aspx%3fProductID%3d2688%26SEName%3dnew-testament-cricut-cartridge", False
' Indicate that the body of the request contains form data
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' Send the data as name/value pairs
xmlhttp.send "Quantity=1&VariantID=2705&ProductID=2688"
Set xmlhttp = Nothing
End Sub
【问题讨论】:
标签: forms vba excel-2010 xmlhttprequest