Free Utility CHKWEBSITE Checks if Web Site Is Available

Article ID: 16478

Herman Van der Staey has posted a free utility CHKWEBSITE in the iSeries NEWS forums that tests if a given Web site is available. Here's a sample program that calls CHKWEBSITE:

TESTWEB: PGM

         DCL        VAR(&AVAILABLE)   TYPE(*LGL)

         CHKWEBSITE WEBSITE('http://www.mycompany.com') +
                    WEBAVAIL(&AVAILABLE)

         IF         COND(&AVAILABLE) THEN(DO)
           SNDPGMMSG  MSG('Website is available')
         ENDDO
         ELSE       CMD(DO)
           SNDPGMMSG  MSG('Website is NOT available')
           SNDDST     TYPE(*LMSG)                                 +
                        TOINTNET((webmaster@yourcompany.com))     +
                        DSTD('Long Message') LONGMSG('The website +
                        is not available. Please take action.')   +
                        SUBJECT('Website not available !')
         ENDDO

END:     ENDPGM

You can obtain the command, CL, and Java source at http://www.iseriesnetwork.com/Forums/Thread.cfm?CFApp=55&Thread_ID=30314&mc=14#Message108051.

ProVIP Sponsors

ProVIP Sponsors