Using composer: Add the following to the composer.json file for your project:
{
"require": {
"wikimedia/deadlinkchecker": "dev-master"
}
}
And then run 'composer update'.
Or using git:
$ git clone https://github.com/wikimedia/DeadlinkChecker.git
Code to determine if a given link on the web is dead or alive.
Sample usage:
$obj = new checkIfDead();
$url = 'https://en.wikipedia.org';
$exec = $obj->isLinkDead( $url );
echo var_export( $exec );
Prints:
false
$obj = new checkIfDead();
$urls = [ 'https://en.wikipedia.org/nothing', 'https://en.wikipedia.org' ];
$exec = $obj->areLinksDead( $urls );
echo var_export( $exec );
Prints:
array (
'https://en.wikipedia.org/nothing' => true,
'https://en.wikipedia.org' => false,
)
This code is distributed under GNU GPLv3+