All Projects → io-developer → Php Whois

io-developer / Php Whois

Licence: mit
PHP WHOIS provides parsed and raw whois lookup of domains and ASN routes. PHP 5.4+ and 7+ compatible

Projects that are alternatives of or similar to Php Whois

Shadowsocks Rust
Oh my implementation of Shadowsocks in Rust
Stars: ✭ 171 (-4.47%)
Mutual labels:  proxy, socks5
Python Whois
Python module/library for retrieving WHOIS information of domains 💻❤
Stars: ✭ 128 (-28.49%)
Mutual labels:  domain, whois
Whois Parser
Go(Golang) module for domain whois information parsing.
Stars: ✭ 123 (-31.28%)
Mutual labels:  domain, whois
Cracker
tunnel over http[s]
Stars: ✭ 107 (-40.22%)
Mutual labels:  proxy, socks5
Whois
Go(Golang) module for domain and ip whois information query.
Stars: ✭ 153 (-14.53%)
Mutual labels:  domain, whois
V2ray Core
A platform for building proxies to bypass network restrictions.
Stars: ✭ 38,782 (+21565.92%)
Mutual labels:  proxy, socks5
Brook
Brook is a cross-platform strong encryption and not detectable proxy. Zero-Configuration. Brook 是一个跨平台的强加密无特征的代理软件. 零配置.
Stars: ✭ 12,694 (+6991.62%)
Mutual labels:  proxy, socks5
Lightsocks Nodejs
It's a simple socks5 proxy tool which based on lightsocks
Stars: ✭ 79 (-55.87%)
Mutual labels:  proxy, socks5
Eagle.tunnel.go
稳定的代理工具,比.NET版本更轻量和易用
Stars: ✭ 143 (-20.11%)
Mutual labels:  proxy, socks5
Pyfunceble
The tool to check the availability or syntax of domain, IP or URL.
Stars: ✭ 143 (-20.11%)
Mutual labels:  domain, whois
Websocks
A secure proxy based on WebSocket. 一个基于 WebSocket 的代理工具
Stars: ✭ 102 (-43.02%)
Mutual labels:  proxy, socks5
Psiphon
A multi-functional version of a popular network circumvention tool
Stars: ✭ 169 (-5.59%)
Mutual labels:  proxy, socks5
Grawler
Grawler is a tool written in PHP which comes with a web interface that automates the task of using google dorks, scrapes the results, and stores them in a file.
Stars: ✭ 98 (-45.25%)
Mutual labels:  proxy, curl
Glider
glider is a forward proxy with multiple protocols support, and also a dns/dhcp server with ipset management features(like dnsmasq).
Stars: ✭ 1,710 (+855.31%)
Mutual labels:  proxy, socks5
Venom
Venom - A Multi-hop Proxy for Penetration Testers
Stars: ✭ 1,228 (+586.03%)
Mutual labels:  proxy, socks5
Flynet
A powerful TCP/UDP tool, which support socks5 proxy by tcp and udp, http proxy and NAT traversal. This tool can help you bypass gfw easily
Stars: ✭ 124 (-30.73%)
Mutual labels:  proxy, socks5
Tor Router
A SOCKS, HTTP and DNS proxy for distributing traffic across multiple instances of Tor
Stars: ✭ 69 (-61.45%)
Mutual labels:  proxy, socks5
Free proxy ss
分享来自互联网上免费的shadowsocks(SS)/ShadowsocksR(SSR)/V2ray(vmess)代理 每15分钟更新一次,每次各分享4个临时可用代理。 及时订阅、及时更新。
Stars: ✭ 72 (-59.78%)
Mutual labels:  proxy, socks5
V2ray Panel Master
Deprecated
Stars: ✭ 136 (-24.02%)
Mutual labels:  proxy, socks5
3proxy
3proxy - tiny free proxy server
Stars: ✭ 2,263 (+1164.25%)
Mutual labels:  proxy, socks5

PHP WHOIS

Build Status PHP version Packagist

PHP WHOIS client implementation. Sends the queries directly to the WHOIS services.

Use case

  • Raw and parsed domain lookup
  • Raw and parsed ASN routes lookup
  • Direct queries to TLD/ASN hosts
  • Extending and customizing the default hosts, parsers, etc.
  • Proxying via CurlLoader

Installation

System requirements:
  • PHP >= 7.2 (previous major version supports 5.4+)
  • php-curl
  • php-mbstring
  • Open port 43 in firewall

Optional:

  • php-intl
  • php-memcached + Memcached server
Project requirements:
  • PSR-4 autoloader
Composer:
composer require io-developer/php-whois

or composer.json:

"require": {
    "io-developer/php-whois": "^4.0"
}

Usage

Domain lookup

How to get summary about domain:
<?php

use Iodev\Whois\Factory;

// Creating default configured client
$whois = Factory::get()->createWhois();

// Checking availability
if ($whois->isDomainAvailable("google.com")) {
    print "Bingo! Domain is available! :)";
}

// Supports Unicode (converts to punycode)
if ($whois->isDomainAvailable("почта.рф")) {
    print "Bingo! Domain is available! :)";
}

// Getting raw-text lookup
$response = $whois->lookupDomain("google.com");
print $response->text;

// Getting parsed domain info
$info = $whois->loadDomainInfo("google.com");
print_r([
    'Domain created' => date("Y-m-d", $info->creationDate),
    'Domain expires' => date("Y-m-d", $info->expirationDate),
    'Domain owner' => $info->owner,
]);

Exceptions on domain lookup:
<?php

use Iodev\Whois\Factory;
use Iodev\Whois\Exceptions\ConnectionException;
use Iodev\Whois\Exceptions\ServerMismatchException;
use Iodev\Whois\Exceptions\WhoisException;

try {
    $whois = Factory::get()->createWhois();
    $info = $whois->loadDomainInfo("google.com");
    if (!$info) {
        print "Null if domain available";
        exit;
    }
    print $info->domainName . " expires at: " . date("d.m.Y H:i:s", $info->expirationDate);
} catch (ConnectionException $e) {
    print "Disconnect or connection timeout";
} catch (ServerMismatchException $e) {
    print "TLD server (.com for google.com) not found in current server hosts";
} catch (WhoisException $e) {
    print "Whois server responded with error '{$e->getMessage()}'";
}
Proxy with SOCKS5:
<?php

use Iodev\Whois\Loaders\CurlLoader;
use Iodev\Whois\Factory;

$loader = new CurlLoader();
$loader->replaceOptions([
    CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5,
    CURLOPT_PROXY => "127.0.0.1:1080",
    //CURLOPT_PROXYUSERPWD => "user:pass",
]);
$whois = Factory::get()->createWhois($loader);

var_dump([
    'ya.ru' => $whois->loadDomainInfo('ya.ru'),
    'google.de' => $whois->loadDomainInfo('google.de'),
]);
TLD hosts customization:
<?php

use Iodev\Whois\Factory;
use Iodev\Whois\Modules\Tld\TldServer;

$whois = Factory::get()->createWhois();

// Define custom whois host
$customServer = new TldServer(".custom", "whois.nic.custom", false, Factory::get()->createTldParser());

// Or define the same via assoc way
$customServer = TldServer::fromData([
    "zone" => ".custom",
    "host" => "whois.nic.custom",
]);

// Add custom server to existing whois instance
$whois->getTldModule()->addServers([$customServer]);

// Now it can be utilized
$info = $whois->loadDomainInfo("google.custom");

var_dump($info);
TLD default/fallback servers:
<?php

use Iodev\Whois\Factory;
use Iodev\Whois\Modules\Tld\TldServer;

$whois = Factory::get()->createWhois();

// Add default servers
$matchedServers = $whois->getTldModule()
    ->addServers(TldServer::fromDataList([
        ['zone' => '.*.net', 'host' => 'localhost'],
        ['zone' => '.uk.*', 'host' => 'localhost'],
        ['zone' => '.*', 'host' => 'localhost'],
    ]))
    ->matchServers('some.uk.net');

foreach ($matchedServers as $s) {
    echo "{$s->getZone()}  {$s->getHost()}\n";
}

// Matched servers + custom defaults:
//
// .uk.net  whois.centralnic.com
// .uk.net  whois.centralnic.net
// .uk.*  localhost
// .*.net  localhost
// .net  whois.crsnic.net
// .net  whois.verisign-grs.com
// .*  localhost

ASN lookup

How to get summary using ASN number:
<?php

use Iodev\Whois\Factory;

$whois = Factory::get()->createWhois();

// Getting raw-text lookup
$response = $whois->lookupAsn("AS32934");
print $response->text;

// Getting parsed ASN info
$info = $whois->loadAsnInfo("AS32934");
foreach ($info->routes as $route) {
    print_r([
        'route IPv4' => $route->route,
        'route IPv6' => $route->route6,
        'description' => $route->descr,
    ]);   
}

Response caching

Some TLD hosts are very limited for frequent requests. Use cache if in your case requests are repeating.

<?php

use Iodev\Whois\Factory;
use Iodev\Whois\Loaders\SocketLoader;
use Iodev\Whois\Loaders\MemcachedLoader;

$m = new Memcached();
$m->addServer('127.0.0.1', 11211);
$loader = new MemcachedLoader(new SocketLoader(), $m);

$whois = Factory::get()->createWhois($loader);
// do something...

Contributing

The project is open for pull requests, issues and feedback. Please read the CODE_OF_CONDUCT.md

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].