コード例 #1
0
 public function LookupDomain()
 {
     //get domain from url
     $domain = Input::get('domain');
     $apikey = Input::get('api_key');
     //see if we have an api key
     if (!$apikey) {
         //no api key provided
         return Response::json(array('success' => false, 'result' => 'No api key provided'), 400);
     } else {
         //check that api key is valid
         $check_apikey = ApiKey::where('api_key', '=', $apikey)->count();
         if ($check_apikey == 0) {
             //api key provided is not valid
             return Response::json(array('success' => false, 'result' => 'The api key provided could not be found, or is not valid.'), 400);
         }
     }
     //split domain into parts
     $domain_parts = explode(".", $domain);
     $tld = strtolower(array_pop($domain_parts));
     //check for whois server in the database
     $checktld = WhoisServers::where('tld', '=', $tld)->count();
     if ($checktld == 0) {
         //no server was found for the tld
         return Response::json(array('success' => false, 'result' => 'No appropiate Whois server found for $domain domain!'), 400);
     }
     //whois server for the requested tld was found, get the server
     $whoisserver = WhoisServers::where('tld', $tld)->pluck('server');
     //perform the whois query
     $result = $this->QueryWhoisServer($whoisserver, $domain);
     if (!$result) {
         //no response recieved from the whois server
         return Response::json(array('success' => false, 'domain' => $domain, 'whois_server' => $whoisserver, 'result' => 'No results retrieved from $whoisserver for $domain domain!'), 400);
     } else {
         while (strpos($result, "Whois Server:") !== FALSE) {
             preg_match("/Whois Server: (.*)/", $result, $matches);
             $secondary = $matches[1];
             if ($secondary) {
                 $result = $this->QueryWhoisServer($secondary, $domain);
                 $whoisserver = $secondary;
             }
         }
     }
     //whois lookup was successful, return the results
     return Response::json(array('success' => true, 'domain' => $domain, 'whois_server' => $whoisserver, 'result' => $result), 200);
 }
コード例 #2
0
ファイル: DNSWhoisController.php プロジェクト: whoisdoma/core
 public function getUrlData()
 {
     $this->domain = Input::get('domain');
     $this->apikey = Input::get('api_key');
     //see if we have an api key
     if (!$this->apikey) {
         $this->errmsg = 'No api key provided';
         return false;
     } else {
         //check that api key is valid
         $check_apikey = ApiKey::where('api_key', '=', $this->apikey)->count();
         if ($check_apikey == 0) {
             $this->errmsg = 'The api key provided could not be found, or is not valid.';
             return false;
         }
         return true;
     }
 }
コード例 #3
0
ファイル: AdminController.php プロジェクト: whoisdoma/core
 public function post_delete_apikey($id)
 {
     $apikey = ApiKey::find($id);
     $apikey->delete();
     return Redirect::back()->withSuccess('The api key has been deleted successfully.');
 }