Introduction:
JustPageProbe is a handy, free,
ActiveX DLL (JustPageProbe.dll) for testing Web pages and
other applications, it also has an email method built in to
send emails when certain conditions exist.
It can be used with home and/or enterprise networks.
JustPageProbe opens any URL
of your choice and reads the entire text content of that Web
Page. It is very easy to use. Typically it is run from a
scheduled task using a simple VBScript so that it can
periodically read the page you have specified. It can also be
added to any application that can 'drive' an
ActiveX Component - like Visual Basic, C/C++ or any number of
host environments such as Office applications (Excel, Word)
etc.
By using a scheduled task, you do not need to be logged on to
the testing computer. It can run 24x7. (e.g. a monitoring server
or workstation.)
Installation:
The
JustPageProbe component runs on Windows 2000 (SP3) or higher,
XP, Windows Server 2003 (all), Windows Server 2008 (all), Windows Vista (all). Simply run setup.exe to install
JustPageProbe in the default location (or location of your
choice).
Following Microsoft guidelines,
if you use the default location, note that any log files used
with JustPageProbe should not be placed in C:\Program
Files\Eastern Digital\JustPageProbe\ as this area is read
only for Windows non-administrative users.
NOTE: JustPageProbe is free of any spyware, addware,
PhoneHomeWare, malware or
Viruses/Trojans etc.
Here is a simple VBScript to
test a Web page and return the time taken in seconds to retrieve the page.
Option
Explicit
Dim Page, URLtoProbe,
ResultURLtoProbe =
"http://www.microsoft.com"
On Error Resume Next
Set
Page = CreateObject("JustPageProbe.PageProbe")
Result = Page.PageProbeTime(URLtoProbe)
Set
Page =
Nothing
MsgBox(Result) |
Some examples of
JustPageProbe uses:
-
Have JustPageProbe
check a web page at fixed intervals.
If a failure is detected i.e. the probe fails to find the
keyword that you know is in the page, an optional alert can be sent by
email to any address (e.g. webmaster or system
administrator). Simply set up several scheduled tasks, or
run through your tests sequentially if you have a large
number of Web servers to test. See sample code here.
-
Have JustPageProbe 'probe'
a site that returns the Internet IP address of your router
/ Computer.
Extract the IP and have it emailed to you at another
location! Great for accessing your home network if you are
not using a dynamic DNS service (or that service updates too
slowly). See sample code here.
-
Keep
your router (internet connection) "always on". A large number of routers log off after 5 minutes of
inactivity. This can make your first Web page load seem very
slow to load as the log-on is processed.
Simply set up a scheduled task to have JustPageProbe call any web page every 3 minutes to
keep your router connection "up"!
If you are being charged by the megabyte, most ISP companies have free
sites - simply point JustPageProbe at one of those free
pages. See sample code here.
Functions:
Note:
When searching the Web page text
for the desired key phrase string, all testing is performed
internally in uppercase.
Function |
Return Value |
Parameters |
Sample |
PageDownload |
String
All raw html for the page under test. |
UrlToDownload as a string e.g. "http://google.com" |
 |
PageProbe |
Formatted string
containing the following details:
Sent page request at:
30/03/2007 7:38:27 PM
Response complete at: 30/03/2007 7:38:31 PM
Duration: 4
Key text found ok. OR
Key text NOT FOUND. |
UrlToTest
as a string, Key text expected to be found as a
string |
 |
PageProbeFindText |
Boolean
VB/VBScript True or False (True = Key text found).
|
UrlToTest
as a string, Key text expected to be found as a
string. |
 |
PageProbeTime |
Variant
Seconds taken to retrieve page.
VB/VBScript (Integer). |
UrlToTest
as a string e.g. "http://google.com" |
 |
SendEmail |
Variant
Either 0 (Integer) Email sent ok. OR
VB/VBScript Error number (Integer). |
From as a
string, To as a string, Subject as a string, Msg as a
string, SMTP Server as a string |
 |
Function Samples:
PageDownload
Download all
web page text and write to a file.
Option
Explicit
Dim
Page, URLtoDownload, Results, fsolog, ts, File
Const
ForReading = 1, ForWriting = 2, ForAppending = 8
URLtoDownload =
"http://www.microsoft.com"
On Error Resume Next
Set Page =
CreateObject("JustPageProbe.PageProbe")
Results = Page.PageDownload(URLtoDownload)
Set
Page =
Nothing
WriteToFile(Results)
' Write raw web page to a text file
'------------ WriteToFile
------------------
Function
WriteToFile(Msg)
Set fsolog =
CreateObject("Scripting.FileSystemObject")
Set
ts = fsolog.OpenTextFile("results.log", ForWriting,
True)
ts.write Msg
ts.Close
Set
ts =
Nothing
Set
fsolog =
Nothing
End
Function |
PageProbeFindText
Check if a
web page contains certain text (often used by system
administrators to check if the web page is working ok)
Sends an alert email if web page fails.
Assume this script is simply
run every 5 minutes from a scheduled task.
Option
Explicit
Dim
Page, URLtoProbe, KeyPhrase, From, Recipient, Subject,
smtpserver, Result, Res
URLtoProbe =
"http://www.google.com"
KeyPhrase = "</html>"
smtpserver = "smtp.myisp.com"
From = "[email protected]"
Recipient = "[email protected]"
Subject = "Web Page has Failed"
On
Error Resume Next
Set
Page = CreateObject("JustPageProbe.PageProbe")
Result = Page.PageProbeFindText(URLtoProbe, KeyPhrase)
If
Result = False
Then
Res = Page.SendEmail(From, Recipient, Subject, URLtoProbe & "
" & Now, smtpserver)
End
If
Set
Page =
Nothing |
PageProbeTime
Test a Web
page and return the time taken in seconds to retrieve the page.
Option
Explicit
Dim Page, URLtoProbe,
ResultURLtoProbe =
"http://www.microsoft.com"
On Error Resume Next
Set
Page = CreateObject("JustPageProbe.PageProbe")
Result = Page.PageProbeTime(URLtoProbe)
Set
Page =
Nothing
MsgBox(Result) |
PageProbe
Test a Web
page and return information.
Option
Explicit
Dim
Page, URLtoProbe, KeyPhrase, Result, Res
URLtoProbe =
"http://www.google.com"
KeyPhrase = "</html>"
On
Error Resume Next
Set
Page = CreateObject("JustPageProbe.PageProbe")
Result = Page.PageProbe(URLtoProbe, KeyPhrase)
Set
Page =
Nothing
MsgBox(Result) |
SendEmail
Option
Explicit
Dim
Page, From, Recipient, Subject, Msg, smtpserver, Res
smtpserver = "smtp.myisp.com"
From = "[email protected]"
Recipient = "[email protected]"
Subject = "This is the subject"
Msg = "This is a message"
On
Error Resume Next
Set
Page = CreateObject("JustPageProbe.PageProbe")
Res = Page.SendEmail(From, Recipient, Subject,
Msg, smtpserver)
Set
Page =
Nothing |
More Samples:
Discover
your WAN IP and send it by email.
Run this
program from a scheduled task. Once every hour should do.
Note that the site
www.whatismyip.com may alter at any time.
There are also many other IP returning sites on the internet.
Choose one that suits you.
Option
Explicit
Dim
Page, URLtoDownload, Results, Found
Dim StrIP,
IP, Cnt, Char
Dim From,
Recipient, Subject, smtpserver, Result, Res
smtpserver =
"smtp.myisp.com"
From =
"[email protected]"
Recipient =
"[email protected]"
Subject =
"Here is your IP Address"
URLtoDownload =
"http://www.whatismyip.com"
On
Error Resume Next
Set
Page = CreateObject("JustPageProbe.PageProbe")
Results = Page.PageDownload(URLtoDownload)
Found = instr(1, Results,
"Your IP
Is")
If
Found > 0
Then
StrIP = Mid(Results, Found + 11, 16)
Cnt = 1
IP =
""
While Char <>
"<"
Char = Mid(StrIP, Cnt, 1)
If
Char <> "<"
Then
IP = IP + Char
End
If
Cnt = Cnt + 1
Wend
End
If
Res = Page.SendEmail(From, Recipient, Subject, IP,
smtpserver)
Set
Page =
Nothing |
Keep your
Internet connection really always on.
Run this
program from a scheduled task every 3 minutes or so.
Option
Explicit
Dim Page, URLtoProbe,
Results, fsolog, ts, File
Const
ForReading = 1, ForWriting = 2, ForAppending = 8URLtoProbe =
"http://www.freesite.com" ' Enter a free
site or simple Web page destination here
On Error Resume Next
Set
Page = CreateObject("JustPageProbe.PageProbe")
Results = Page.PageProbe(URLtoProbe, "</html>")
Set
Page =
Nothing
DoLog(Results)
'------------ DoLog
------------------
Function
DoLog(Msg)
Set
fsolog = CreateObject("Scripting.FileSystemObject")
Set
ts = fsolog.OpenTextFile("results.log",
ForAppending, True)
ts.write Msg
ts.Close
Set
ts =
Nothing
Set File = fsolog.GetFile("results.log")
if
File.Size > 1000000
Then
'Delete
log file when it gets too big and start over.
fsolog.DeleteFile("results.log")
End
If
Set
File =
Nothing
Set
fsolog =
Nothing
End
Function |
Further samples
for scripting or including this component in a C/C++, VB, VB.NET,
C# client application may be provided in the future.
If you use
the component in IIS with ASP or ASP.NET be sure
to place it in a COM+ application to ensure it will have the
ability to perform its functions without security (access
denied) issues. Check out our documentation for the "JustFTP"
component which provides a COM+ walkthrough that you can use
with JustPageProbe in ASP/ASP.NET.
http://www.easterndigitalsoftware.com/justftp/walkthrough.htm
Suggestions and
Enhancements welcome. Please send them to
[email protected]
Enjoy!
Download and use JustPageProbe for FREE
|