Check the status of a website

2.1.3 2013-07-25 11:05 UTC


Build Status

This micro library aims just to connect to a URL and return the status of the response, like the status code, response milliseconds and a few more details.

Install it via Composer

On your composer.json…

  "require": {
    "checkstatus/checkstatus": "dev-master"

Example of usage

// Load Composer's autoload
require './vendor/autoload.php';

// Prepare some settings
$checkStatus = new CheckStatus\CheckStatus;
$url = '';

// Need to use a proxy?, you're covered

// Fetch the data
$status = $checkStatus->fetchUrl($url);

// Milliseconds
echo $status->getResponseTime();

// Status code
echo $status->getCode();

// URL used to generate the report
echo $status->getUrl();

// When did we fetch the URL?
echo $status->getTimestamp();

// All together
$summary = $status->getSummary();

Any question?

Follow me (@PiradoIV) at Twitter.