Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SHDocVw.InternetExplorer navigate parameters 1

Status
Not open for further replies.

GregTheGeek

Programmer
Aug 11, 2004
46
US
I have been trying to use the shDocVw.InternetExplorer object to open and navigate websites. From everything I've read, it looks like POST data can be included as a parameter in the navigate or navigate2 methods. The MSDN documentation of these two methods is a bit...enigmatic (at least to me and a co-worker):
Code:
    Dim objIE As New InternetExplorer
    
    With objIE
        .Navigate "[URL unfurl="true"]http://www.myurl.com",,,"username=user&password=pass"[/URL]
        .Visible = True
    End With

It is my understanding that this optional parameter will include data as a POST request to the url specified. I am having trouble getting this to work. Has anyone had any success? MSDN also metions the Navigate2 method stating: The post data specified by PostData is passed as a SAFEARRAY Data Type structure.

Any help would be appreciated.

Thanks in advance!


gtg.jpg

GTG
 
Like this and at least this is what the documentation meant.
[tt]
dim header as string
dim url as string
dim sformdata as string
dim ostream as stream
dim osformdata() as byte
dim oie as SHDocVw.InternetExplorer

header = "Content-Type: application/x- & vbcrlf
url = "sformdata = "username=user&password=pass"

set ostream = new stream
with ostream
.type = 2
.charset = "windows-1252" 'latin-1
.open
.writetext sformdata
.position = 0
.type = 1 'binary
osformdata = .read 'as Byte()
.close
end with
set ostream = nothing

set oie = New SHDocVw.InternetExplorer
oie.navigate2 url,,,osformdata,header
oie.visible = true
[/tt]
ps: I use helper ado.stream. In vb(s), it is just a choice among others. Posting password may need encryption.
 
Perfect! Thank you! I guess I just didn't get the part about putting each byte of the form into an array. I would have never thought of adding the header either.

Thank you again!


gtg.jpg

GTG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top