Use IE to call up a URL and search for a specific string in the response

Ok- Here goes.  Is it possible to create a vbscript that will call up a URL using "iexplore.exe www.website.com" and search the response for a string?  I ask this because I have a database engine that connects our online store with the backend DB.  This is an active page (ASP) and my server monitoring software uses WINHttp, which gets the "unsupported browser" message response.  The server monitor software supports the use of vbscripts- but I am not a programmer...
LVL 1
jcneil4Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marv-inCommented:
1. create a asp page on your server

<--start page.asp-->
<%
var objXML = new ActiveXObject("Msxml2.XMLHTTP");
objXML.open("GET", "http://www.website.com", false);
objXML.send();
strDocument = objXML.ResponseText

strWhatYourLookingFor="this is what i want to match"

if instr(strDocument,strWhatYourLookingFor) then
  '//do what you need to
else
  '//do somthing when it doesnt match
endif
%>
<--end page.asp-->

then you can setup a scheduled task in windows to launch iexplorer http://yousite/page.asp

I will need more info on what you want to do if the string is matched or not to finish the code
0
jcneil4Author Commented:
Ok, this may work.  I'm not sure what I want to happen but lets start with something simple like have our asp page display "the site is running" or "the site is down".   I'll have to test it in our enviornment with my server monitor software-
Thanks for the quick response.
0
Marv-inCommented:
<%
var objXML = new ActiveXObject("Msxml2.XMLHTTP");
objXML.open("GET", "http://www.website.com", false);
objXML.send();
strDocument = objXML.ResponseText

strSearch="site is up" 'this string will need to be the exact text you are looking for at www.website.com

if instr(strDocument,strSearch) then
  response.write("your site is up")
else
  response.write("your site is down")
endif
%>
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

jcneil4Author Commented:
When I call up the page in a IE I get --HTTP 500 - Internal server error Internet Explorer--
Here is the code I am using...


<--start sitecheck.asp-->

<%
var objXML = new ActiveXObject("Msxml2.XMLHTTP");
objXML.open("GET", "http://www.mysite.com", false);
objXML.send();
strDocument = objXML.ResponseText

strSearch="Products and Services"

if instr(strDocument,strSearch) then
  response.write("your site is up")
else
  response.write("your site is down")
endif
%>

<--end sitecheck.asp-->
0
Marv-inCommented:
could you turn off friendly errors in IE [tools -> internet options -> advanced tab] and post the exact error you recieve.
0
jcneil4Author Commented:
Microsoft VBScript compilation error '800a0401'

Expected end of statement

/admin/sitecheck.asp, line 4

var objXML = new ActiveXObject("Msxml2.XMLHTTP");
------------------------------^
0
Marv-inCommented:
Set objXML = Server.CreateObject("MSXML2.XMLHTTP")
0
jcneil4Author Commented:
Microsoft VBScript compilation error '800a0414'

Cannot use parentheses when calling a Sub

/admin/sitecheck.asp, line 6

objXML.open("GET", "http://www.mysite.com", false);
--------------------------------------------------^
0
Marv-inCommented:
Set objXML = Server.CreateObject("MSXML2.XMLHTTP")
call objXML.open("GET", "http://www.mysite.com", false);
call objXML.send;
strDocument = objXML.ResponseText

this code should will work - i tested it this time
0
jcneil4Author Commented:
We are getting there...

Microsoft VBScript compilation error '800a0401'
Expected end of statement
/admin/sitecheck.asp, line 6
call objXML.open("GET", "http://www.mysite.com", false);
-------------------------------------------------------^
0
Marv-inCommented:
Set objXML = Server.CreateObject("MSXML2.XMLHTTP")
call objXML.open("GET", "http://www.mysite.com", false)
call objXML.send
strDocument = objXML.ResponseText

remove the semicolons - as doesnt use them - i must have java on the brain =]
0
jcneil4Author Commented:
we are close..
__________________________________
Microsoft VBScript compilation error '800a0400'
Expected statement
/admin/sitecheck.asp, line 17
endif
^
_____________________________________
here is what we have so far-

<--start sitecheck.asp-->
<%
Set objXML = Server.CreateObject("MSXML2.XMLHTTP")
call objXML.open("GET", "http://www.mysite.com", false)
call objXML.send
strDocument = objXML.ResponseText
strSearch="Products and Services"
if instr(strDocument,strSearch) then
  response.write("your site is up")
else
  response.write("your site is down")
endif
%>
<--end sitecheck.asp-->



0
Marv-inCommented:
its end if not endif
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jcneil4Author Commented:
OK!  It works great.  You got your points.
0
Marv-inCommented:
Thanks for the grade!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.