martijn Posted September 29, 2006 Posted September 29, 2006 (edited) So close, but..... I'm trying to send a POST to a url, but failed in passing the right parameter into the navigate function for the POST-data. I've read that AutoIt converts objects or variables to safearrays automatically, but what should the autoit-variable look like in order to get an automatically converted safearray, that matches the following description (taken from above url): The post data specified by PostData is passed as a SAFEARRAY Data Type structure. The VARIANT should be of type VT_ARRAY and point to a SAFEARRAY Data Type. The SAFEARRAY Data Type should be of element type VT_UI1, dimension one, and have an element count equal to the number of bytes of post data. Edit: Here's the code snippet that I currently use for testing purposes (no valid url)#include <IE.au3> #include <array.au3> #include <GUIConstants.au3> Dim $url, $postdata $url = "http://www.server.com/process.php" $postdata = "a=dont&b=know&c=how&d=to&e=set&f=this&g=properly" $oInternet = _IECreate($url,False,True) $oInternet.navigate($url,"","",$postdata) _IELoadWait($oInternet) I'v tried passing the following variables, but they all seem to fail in passing the proper values: Dim $postdata[1] $postdata[0] = "var1=on&id=12" Dim $postdata[2] $postdata[1] = "2" $postdata[0] = "var1=on&id=12" Dim $postdata $postdata = "var1=on&id=12" Dim $postdata $postdata[13] = ["v","a","r","1","=","o","n","&","i","d","=","1","2"] If someone can give me information how to solve this, I would be very greatfull Edited September 29, 2006 by martijn
martijn Posted September 29, 2006 Author Posted September 29, 2006 Added Referer and Content-Type to the http-headers. Still missing the POST-data in a HTTP Sniffer #include <IE.au3> #include <array.au3> #include <GUIConstants.au3> Dim $postdata[1] $posturl = "http://www.server.com/process.php" $postdata[0] = "a=do&b=know&c=how&d=to&e=set&f=this&g=properly" $headerdata = "Content-Type: application/x-www-form-urlencoded" & Chr(13) & _ "Referer: http://www.server.com/process.php" $oInternet = _IECreate() $oInternet.navigate($posturl,"","",$postdata,$headerdata) Anyone?
martijn Posted September 29, 2006 Author Posted September 29, 2006 In the original POST from IE I see a Content-Length header that has a value of 22.But in my post it reports as having a length of 16. It seems that every element in the $postdata array takes up 16 bytes in the final POST-request.After googling around, I'm almost convinced that I should send a byte array as parameter.How the -bleep- should I do that?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now