checkstatus/checkstatus

Check the status of a website

Installs: 29

Dependents: 0

Stars: 2

Watchers: 1

Language: PHP

2.1.3 2013-07-25 11:05 UTC

README

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

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

// Prepare some settings
$checkStatus = new CheckStatus\CheckStatus;
$url = 'http://www.example.com/';

// Need to use a proxy?, you're covered
$checkStatus->setProxy('111.111.111.111:80');
$checkStatus->setProxyAuth('username:password');

// 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();
print_r($summary);

Any question?

Follow me (@PiradoIV) at Twitter.