Getting uptime reports for a site with our PHP SDK

Make sure you've read the getting started guide first. Once that's done, you should have our package & authentication ready to go.

Getting broken links

You can get uptime with the uptime() method on a site. The method expects three parameters:

  • start: a date in the form of YmdHis that determines the start of the range you want to get uptime for
  • end: a date in the form of YmdHis that determines the start of the range you want to get uptime for
  • split: a string that determines how fine grained the answer periods should be. Valid values are hour, day and month.
$ohDear->site($siteId)->uptime($start, $end, $split);

//alternatively you could do this
$ohDear->uptime($siteId, $start, $end, $split);

Both methods above will return an array of OhDear\PhpSdk\Resources\Uptime instances. A Uptime instance.

// The start of the period
$uptime->datetime;

// A float representing the percentage of time the site was up
$uptime->uptimePercentage;