Getting broken links 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

Here's how to get the broken links for a given site.

$ohDear->site($siteId)->brokenLinks();

//alternatively you could do this
$ohDear->brokenLinks($siteId);

Both methods above will return an array of OhDear\PhpSdk\Resources\BrokenLink instances.

You can get a few properties of a broken link.

// The status code the site responded with
$brokenLink->statusCode;

// The url that is broken.
$brokenLink->crawledUrl;

// The url where the broken url was found.
$brokenLink->foundOnUrl;