SiteChecker is a demonstration site built with PHP, MySQL, Bootstrap, jQuery and the Yii framework.
After a user enters a site URL they are told whether the site is up or down. The site check is also stored to a DB so the most recent checks can be displayed.
AJAX calls are used to perform the site check and to load the list of previous checks.
A lot of the code is boilerplate generated by Yii, but the files I would draw your attention to are:
- This is the controller entry point. The actionSitecheck() and actionRecentsitechecks() functions are REST endpoints for checking a site and retrieving a list of previous checks respectively.
- The Yii model class for validating user input and retrieving the most recent site checks from the DB.
- A Yii ActiveRecord class used for saving and retrieving site checks to the DB.
- The component that performs the actual site check. I provides two different ways to check a site: using the cURL library, and doing a raw socket connection.
- The primary view used to display the form, site check result, table of recent checks, and perform the AJAX calls.