S
shaun.kohanowski
Hey,
I'm developing a class that works with a webpage. The intention is to
incapsulates a local intranet server side program called PeopleSoft
(for those who know what that means inorder to work with cases
handled by it. When the class is instanted its designed to open a
casenumber that is passed to the program and create a local copy of all
the relavent information for that case. Each instance of the object is
a dif case. I need to beable to request a case and capture the responce
to a string inorder to remove and handle the alert msgs. I then write
the altered code to an instance of internet explorer and let it do the
parsing. after that its only a matter of reading the values I need from
IE.
My problem is this:
Everytime I send a case request, the responce I get is a login screen.
I have a working prototype made out of spigetty code and ducktape. In
that implementation I create a static instance of IE and login to the
site with it. I'm then able to create as many additional instances of
IE as I need without loging in again.
I'm assuming that the variant that the server needs to ID me isn't
visible to the server through the open connection.
I know HTML very well but I don't work with network connections very
much. I would like to use IE to parse the HTML but in order to do that
I need to intercept the alert msgs before I send it to IE.
Is there a way I can login once and use an open connection to retrieve
the HTML soucre for each case as it comes along?
This newsgroup has been my signal greatest asset for my project
development, I hope you can help me with this as well
Thank alot
Shaun
Here are the functions I'm working with:
Private Function Nav(sURL As String)
Dim oRegEx As RegExp
Set oRregEx = New RegExp
With regEx
..IgnoreCase = True
..MultiLine = True
..Global = True
..Pattern = "^(javascript)"
End With
If oRegEx.test(sURL) Then
PS.Navigate sURL
Else
Dim sWebpg As String
Dim oAlertErrs As MatchCollection
Dim oMatch As Match
Dim sAlertErr As String
sWwebpg = OpenURL(sURL)
oRegEx.Pattern = "<title>PeopleSoft 8 Sign-in</title>"
If regEx.test(sWebpg) Then
Load PSLogin
PSLogin.Show
End If
oRegEx.Pattern = "alert\('.*'\);"
sAlertErr = ""
Set oAlertErrs = oRegEx.Execute(sWebpg)
For Each oMatch In oAlertErrs
sAlertErr = sAlertErr & " " & oMatch.Value
Next
With PS.Document
..Clear
..Open
..Write oRegEx.Replace(sWebpg, "")
..Close
End With
End If
End Function
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 * 2048
Dim sData As String
On Error GoTo errChk
Const INTERNET_PRECONFIG = 0
hOpen = InternetOpen("uFreedb", INTERNET_PRECONFIG, vbNullString,
vbNullString, 0)
If (hOpen <> 0) Then
hOpenUrl = InternetOpenUrl(hOpen, sURL, vbNullString, 0,
&H80000000, 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
errChk:
'internal error
If (hOpen <> 0) Then InternetCloseHandle (hOpen)
End Function
I'm developing a class that works with a webpage. The intention is to
incapsulates a local intranet server side program called PeopleSoft
(for those who know what that means inorder to work with cases
handled by it. When the class is instanted its designed to open a
casenumber that is passed to the program and create a local copy of all
the relavent information for that case. Each instance of the object is
a dif case. I need to beable to request a case and capture the responce
to a string inorder to remove and handle the alert msgs. I then write
the altered code to an instance of internet explorer and let it do the
parsing. after that its only a matter of reading the values I need from
IE.
My problem is this:
Everytime I send a case request, the responce I get is a login screen.
I have a working prototype made out of spigetty code and ducktape. In
that implementation I create a static instance of IE and login to the
site with it. I'm then able to create as many additional instances of
IE as I need without loging in again.
I'm assuming that the variant that the server needs to ID me isn't
visible to the server through the open connection.
I know HTML very well but I don't work with network connections very
much. I would like to use IE to parse the HTML but in order to do that
I need to intercept the alert msgs before I send it to IE.
Is there a way I can login once and use an open connection to retrieve
the HTML soucre for each case as it comes along?
This newsgroup has been my signal greatest asset for my project
development, I hope you can help me with this as well
Thank alot
Shaun
Here are the functions I'm working with:
Private Function Nav(sURL As String)
Dim oRegEx As RegExp
Set oRregEx = New RegExp
With regEx
..IgnoreCase = True
..MultiLine = True
..Global = True
..Pattern = "^(javascript)"
End With
If oRegEx.test(sURL) Then
PS.Navigate sURL
Else
Dim sWebpg As String
Dim oAlertErrs As MatchCollection
Dim oMatch As Match
Dim sAlertErr As String
sWwebpg = OpenURL(sURL)
oRegEx.Pattern = "<title>PeopleSoft 8 Sign-in</title>"
If regEx.test(sWebpg) Then
Load PSLogin
PSLogin.Show
End If
oRegEx.Pattern = "alert\('.*'\);"
sAlertErr = ""
Set oAlertErrs = oRegEx.Execute(sWebpg)
For Each oMatch In oAlertErrs
sAlertErr = sAlertErr & " " & oMatch.Value
Next
With PS.Document
..Clear
..Open
..Write oRegEx.Replace(sWebpg, "")
..Close
End With
End If
End Function
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 * 2048
Dim sData As String
On Error GoTo errChk
Const INTERNET_PRECONFIG = 0
hOpen = InternetOpen("uFreedb", INTERNET_PRECONFIG, vbNullString,
vbNullString, 0)
If (hOpen <> 0) Then
hOpenUrl = InternetOpenUrl(hOpen, sURL, vbNullString, 0,
&H80000000, 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
errChk:
'internal error
If (hOpen <> 0) Then InternetCloseHandle (hOpen)
End Function