doc.loadxml(axwebbrowser1.document.body.outerhtml), doesn't work?

  • Thread starter Thread starter MeNotHome
  • Start date Start date
first, let me re-post what fergus...err...iron/gold guru...said.

"If you set up an asp or aspx page on your server at home or work, you can
get it to display the headers of the request that invokes it. If you can
fiddle the link html in the AxBrowser to call <your> page instead of the
real
website, you can do the same - find out what the headers are. Then you can
use
HttpRequest and set <its> headers to those values."

also, you can use your standard browser, go the the page in question - the
one that submits the information to the xml producing web page. once on that
page, view it's source. you will most likely see <form></form> tags...if
there are multiple forms, then look for the appropriate one that submits to
the target xml page. get the names of all (including type="hidden") it's
elements and their values.

from there you will submit the headers discovered in the manner described by
fergus and the form data discovered as above...i don't know what kind of
example i can get/do but i'll try one.

i assume at this point you neither want to try to continue using the
axbrowser control nor discover where it is placing the xml results?
 
I would love to be able to continue to use the axwebbrowser. I have
everything working up to this point.

If I could just get the xml data from the axwebbrowser, then the
battle would be over.

But no matter what I try, I can't get the xml data from the browser
control.

I will try what you suggested regarding looking for the input and
hidden fields.

Thanks for any additional help
 
Hi MeNo,

There's still that option of posting a zip of the web pages that you are
playing with (including the one with the xml). I can't promise but it might be
useful.

Regards,
Fergus
 
;^)

btw...i've posted data to web sites before through apis in vb6. the example
i was trying to "cook up" for the op isn't quite working. any ideas on the
following (btw, it has mutated several times in an attempt to get a working
one...the code either reflects that or my ignorance...you pick). would
including "Expect" in the header and waiting for "100 (Continue)" before i
post the data make a difference here...haven't had to before, but it is part
of the rfc.

' the accounts.php page posts u/pass to itself...if successful, redirects to
siteauth.php

Imports System.Net
Imports System.Net.HttpWebRequest
Imports System.Net.HttpWebResponse

Private Const authorizationPage As String =
"http://www.renderbar.com/secure/siteauth.php"
Private Const targetPage As String =
"http://www.renderbar.com/secure/accounts.php" ' should redirect to the
above page.

Function sendWebRequest() As String
Dim webRequest As HttpWebRequest = webRequest.Create(authorizationPage)
Dim webResponse As HttpWebResponse
Dim pageData As String = "username=support&password=diver"
With webRequest
.ContentType = "application/x-url-formencoded" ' tried many
combinations...thought text/html w/b the best bet.
.ContentLength = pageData.Length
.KeepAlive = True
.Method = "POST"
.Timeout = 60 * 1000 ' milliseconds to seconds
Dim streamWriter As New StreamWriter(.GetRequestStream())
streamWriter.Write(pageData)
streamWriter.Close()
webResponse = DirectCast(.GetResponse(), HttpWebResponse)
End With
Dim stream As Stream = webResponse.GetResponseStream
Dim streamReader As New StreamReader(stream)
Dim xmlStream As String = streamReader.ReadToEnd
streamReader.Close()
stream.Close()
Return xmlStream
End Function
 
ok mnh! this works on my website...modify to your liking.

Imports System.IO
Imports System.Net
Imports System.Net.HttpWebRequest
Imports System.Net.HttpWebResponse
Imports System.Web
Imports System.Web.HttpUtility

Module webTest

Private Const authorizationPage As String =
"http://www.renderbar.com/secure/siteauth.php"
Private Const targetPage As String =
"http://www.renderbar.com/secure/accounts.php"

Public Sub Main()
' post web data test
Dim params(1) As String
params(0) = "[email protected]"
params(1) = "password=diver"
getWebResponse(authorizationPage, params)
End Sub

#Region " http request "

Function getWebResponse(ByVal url As String, ByVal params As String()) As
String
If url Is Nothing OrElse params Is Nothing Then Return Nothing
Dim webRequest As HttpWebRequest = webRequest.Create(url)
Dim webResponse As HttpWebResponse
Dim param As String
Dim postData As String
For Each param In params
postData &= HttpUtility.HtmlEncode(param) & "&"
Next
postData = postData.Substring(0, postData.Length - 1)
With webRequest
.AllowAutoRedirect = True
.ContentType = "application/x-www-form-urlencoded"
.ContentLength = postData.Length
.KeepAlive = False
.Method = "POST"
.Timeout = 60 * 1000 ' milliseconds to seconds
Dim streamWriter As New StreamWriter(.GetRequestStream())
streamWriter.Write(postData)
streamWriter.Close()
webResponse = .GetResponse()
End With
Dim stream As Stream = webResponse.GetResponseStream
Dim streamReader As New StreamReader(stream)
Dim xmlStream As String = streamReader.ReadToEnd
streamReader.Close()
stream.Close()
Return xmlStream
End Function

#End Region

End Module
 
Back
Top