Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
open web page with POST variables
#1
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)
#2
With Internet Explorer:
Macro Macro2467
Code:
Copy      Help
;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
Code:
Copy      Help
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)
#3
I know you know this already, but you are the most awesome. Never would have figured it out without you. Thanks.
#4
You might want to add this as an option to the "web" function. I created a function called web2 for it.


Forum Jump:


Users browsing this thread: 1 Guest(s)