Esempio n. 1
0
 /**
  * Resolve WHOIS data for domain.
  *
  * @param Request $request
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  * @throws \Exception
  */
 public function index(Request $request)
 {
     $domain = $request->input('domain');
     $isAvailable = false;
     $response = '';
     if ($domain) {
         $whoisServersJson = base_path('vendor/helgesverre/domain-availability/src/data/servers.json');
         $whoisClient = new SimpleWhoisClient();
         $dataLoader = new JsonLoader($whoisServersJson);
         $service = new DomainAvailability($whoisClient, $dataLoader);
         $isAvailable = $service->isAvailable($domain);
         $response = $whoisClient->getResponse();
     }
     return view('whois.form', compact('domain', 'isAvailable', 'response'));
 }
Esempio n. 2
0
<!DOCTYPE html>
<html>
<head>
    <title>Domain Availability Checker</title>
</head>
<body>
<?php 
require './vendor/autoload.php';
use Helge\Loader\JsonLoader;
use Helge\Client\SimpleWhoisClient;
use Helge\Service\DomainAvailability;
$whoisClient = new SimpleWhoisClient();
$dataLoader = new JsonLoader("src/data/servers.json");
$service = new DomainAvailability($whoisClient, $dataLoader);
?>

<div>
    <form style="margin: 10px;" action="" method="get">
        <label for="domain">Domain Name</label>
        <input type="text" name="domain" id="domain">
        <input type="submit" value="Go">
    </form>

    <table border="1" cellpadding="5">
        <tr>
            <td>Status</td>
            <td>
                <?php 
try {
    if (isset($_GET["domain"])) {
        if ($service->isAvailable($_GET["domain"])) {