PHP code example of cookiemc337 / laravel-web-status-checker
1. Go to this page and download the library: Download cookiemc337/laravel-web-status-checker library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cookiemc337 / laravel-web-status-checker example snippets
// config/app.php
'providers' => [
// ...
CookieMC337\Checker\WebStatusCheckerServiceProvider::class,
];
'aliases' => [
// ...
'WebStatusChecker' => CookieMC337\Checker\Facades\WebStatusChecker::class,
];
namespace App\Http\Controllers;
use Ping;
use App\Http\Controllers\Controller;
class LinkController extends Controller
{
/**
* Show the current health of a given URL.
*
* @param string $url
* @return string
*/
public function healthCheck($url)
{
$health = Ping::check($url);
if($health == 200) {
return 'Alive!';
} else {
return 'Dead :(';
}
}
}