I'm using xmlhttp
via vba in excel 2010. I need to programmatically add an item to a shopping cart on a website. I have the code below so far, it uses the POST
method
A couple of things I think are wrong with my code but not sure how to fix - It doesn't show where the form is that is being submitted. Here is that url:
http://www.craft-e-corner.com/p-2688-new-testament-cricut-cartridge.aspx
The url I entered as the url that processes the form is the url in the "action=" part of "form".
How can I verify that the form posted?
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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…