JPERKS1985
asked on
Using the MSHTML collection with a string containing HTML
I'm request html using the following method,
Dim sResult As String
Dim oHttp As HttpWebRequest
Dim objResponse As WebResponse
Dim objRequest As WebRequest = System.Net.HttpWebRequest. Create(Eve ntUrl)
objRequest.Method = "GET"
objRequest.Timeout = 120000 ' 20 sec.
objResponse = objRequest.GetResponse
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(obj Response.G etResponse Stream(), System.Text.Encoding.UTF7)
sResult = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
debug.write(sresult.tostri ng)
Dim DOCHTML As String
doc = DirectCast(sResult, mshtml.HTMLDocument)
dochtml = doc.documentElement.innerH TML()
Debug.Write(DOCHTML)
This doesn't seem to convert the html string so that it can be used with the mshtml collection. If I choose to display the html after it finishes with debug.write(sresult.tostri ng) it will output to the debug window. But when I try to output it with Debug.Write(DOCHTML) it won't work. 500 points because I'm trying to finish the development of this application within the next few weeks. thanks guys.
Dim sResult As String
Dim oHttp As HttpWebRequest
Dim objResponse As WebResponse
Dim objRequest As WebRequest = System.Net.HttpWebRequest.
objRequest.Method = "GET"
objRequest.Timeout = 120000 ' 20 sec.
objResponse = objRequest.GetResponse
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(obj
sResult = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
debug.write(sresult.tostri
Dim DOCHTML As String
doc = DirectCast(sResult, mshtml.HTMLDocument)
dochtml = doc.documentElement.innerH
Debug.Write(DOCHTML)
This doesn't seem to convert the html string so that it can be used with the mshtml collection. If I choose to display the html after it finishes with debug.write(sresult.tostri
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
nevermind I got it working thanks.
ASKER
Now is there a way to use this source to pass cookies? Also is there a way for proxy support? Thats why I was using httprequest
ASKER
Better yet, how do I extract the cookies and route the request for the page through a proxy?
ASKER
For Each elm In all
strName = elm.getAttribute("NAME")
strId = elm.id
strvalue = elm.innerText
strType = elm.getAttribute("type")
Anyway to convert my string to wokr with that?