Sign in to follow this  
Followers 0
martijn

POST-data in proper SAFEARRAY Data Type Structure

3 posts in this topic

#1 ·  Posted (edited)

So close, but..... :P

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 by martijn

Share this post


Link to post
Share on other sites



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? :)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0