open web page with POST variables

Functions, classes, components, etc. Only high quality content.

open web page with POST variables

Postby hirschor on Mon Dec 29, 2014 4:26 pm

I am trying to open a web page with POST instead of GET in order to post some variables to it, but I can't get the code to work. The page opens, but it does not receive the POST variables.

VARIANT flags=0
VARIANT target="_blank"
VARIANT* postdata
VARIANT headers = "Content-Type: application/x-www-form-urlencoded"
SAFEARRAY* psa
str data="a=hello"


psa = SafeArrayCreateVector(VT_UI1,0,len(data))
SafeArrayAccessData(psa, &data)
SafeArrayUnaccessData(psa) ;; not sure if this is needed

postdata = psa

SHDocVw.IWebBrowser2 b=web("")
b.Navigate("http://siuhradweb/test.php" &flags &target postdata &headers)
hirschor
 
Posts: 21
Joined: Thu Apr 12, 2007 3:30 pm

Re: open web page with POST variables

Postby Gintaras on Mon Dec 29, 2014 6:43 pm

With Internet Explorer:
Macro Macro2467     ?
;VARIANT flags=0
;VARIANT target="_blank"
VARIANT postdata
VARIANT headers = "Content-Type: application/x-www-form-urlencoded[]" ;;note []
str data="a=hello"

ARRAY(byte) a.create(data.len)
memcpy(&a[0] data a.len)
postdata.attach(a)

;SHDocVw.IWebBrowser2 b=web("" 8)
SHDocVw.IWebBrowser2 b=web("")
b.Navigate("http://siuhradweb/test.php" @ @ postdata headers)



Without Internet Explorer:
Macro Macro2471     ?
Http x.Connect("siuhradweb")
x.PostAdd("a" "hello")
;x.PostAdd("b" "hello")
;x.PostAdd("c" "hello")
x.PostFormData("test.php")
;to add headers:
;x.PostFormData("test.php" 0 0 headers)

Gintaras
Site Admin
 
Posts: 10412
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Re: open web page with POST variables

Postby hirschor on Mon Dec 29, 2014 6:54 pm

I know you know this already, but you are the most awesome. Never would have figured it out without you. Thanks.
hirschor
 
Posts: 21
Joined: Thu Apr 12, 2007 3:30 pm

Re: open web page with POST variables

Postby hirschor on Mon Dec 29, 2014 7:07 pm

You might want to add this as an option to the "web" function. I created a function called web2 for it.
hirschor
 
Posts: 21
Joined: Thu Apr 12, 2007 3:30 pm


Return to QM Extensions

Who is online

Users browsing this forum: No registered users and 1 guest

cron