For the Pro's

C

CodeSponge

I'm trying to open a connection to a local webserver and take the
source for the page as a string so I can handle the javascript alert
msgs before I thro it at a spreadsheet. Other wise my app just kinda
blinks at me until I tell it to shutup and get back to work. Which I
would prefer not to do because my co-works don't like it when I'm angry
;) anywho, the trick is I would prefer to beable to not have to log in
to the webserver everytime I want to retrieve a page. in the past I've
used an instance of IE glued to a static. After I log into ther server
with it then I can come and go as I please using other instances of IE.
It no wok when I do this with a direct connection.
I have a function here that works well if this was what I wanted it to
do :)
but instead of giving me the page I ask for it gives me the source for
the logon to the webserver. anyone have any ideas on how I could prop
the server door open so I can come and go as I please without having to
have my damn ID out all the time?


'Private Function OpenURL(ByVal sURL As String) As String
' Dim hOpen As Long
' Dim hOpenUrl As Long
' Dim lBytesRead As Long
' Dim sBuffer As String
' Dim sData As String
' const FLAG = &H80000000
' Const PRECONFIG = 0
'
' On Error GoTo DOHerr
'
' hOpen = InternetOpen("PS", PRECONFIG, vbNullString, vbNullString,
0)
'
' If (hOpen <> 0) Then
' hOpenUrl = InternetOpenUrl(hOpen, sURL, vbNullString, 0, FLAG
, 0)
' If (hOpenUrl <> 0) Then
' Do
' sBuffer = vbNullString
' Call InternetReadFile(hOpenUrl, sBuffer, Len(sBuffer),
lBytesRead)
' sData = sData & Left$(sBuffer, lBytesRead)
' Loop Until (lBytesRead = 0)
'
' InternetCloseHandle (hOpenUrl)
'
' End If
'
' InternetCloseHandle (hOpen)
'
' End If
'
' OpenURL = sData
' Exit Function
'
'DOHerr:
' 'internal error
' If (hOpen <> 0) Then InternetCloseHandle (hOpen)
'End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top