Q
Problem solve Get help with specific problems with your technologies, process and projects.

How do I find out if a Web page is static?

How can I automatically test for interactivity of a Web site? In other words, sometimes the site is down, and there is just a static Web page at the address. I want to write a program that will email me if the database is not up and running, as opposed to just having a static page that may be working fine.

How can I automatically test for interactivity of a Web site? In other words, sometimes the site is down, and there is just a static Web page at the address. When ITBS is working, users can type in query text and receive output from the database.

I want to write a program that will email me if the database is not up and running, as opposed to just having a static page that may be working fine.

Mike Ault thanks Michael Cunningham for his help in responding to this question.

Here is a way to do this. This sample assumes the site is NOT https. For that the reader would need to read up on this package in Oracle document B10802-01. It also assumes the machine Oracle is on can make http requests from the Internet.

The anonymous block below looks at the Google site. On that site there is an HTML input item with the name of "q" (where the search text is typed in). The code below checks to see if the item with "name=q" exists on the HTML page. For the reader I would think he/she could do the same, but for a particular item on the page of the 'interactive' page mentioned. If the item does not exist on the page, then the text returned in the request is likely for a static page.

Also note: The http response is returned in a TABLE type. I'm only checking the first array item in the TABLE. If the http response is larger you would need to check more array items.

declare
   html_pieces utl_http.html_pieces; -- TABLE type each item is VARCHAR2(2000)
   n_length pls_integer;
begin
   html_pieces := utl_http.request_pieces( 'https://www.google.com/', 10 );
   n_length := instr( html_pieces(1), 'name=q' );
   if n_length <> 0 then
      dbms_output.put_line( 'Page is not static.' );
   else
      dbms_output.put_line( 'Page is static.' );
   end if;
end;
/

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close