Whois API
API Kiểm tra trạng thái tên miền đã được đăng ký hay chưa
Request
| URL | Method | Output Format | Limit Rate |
|---|---|---|---|
https://api.hostvn.org/api/v1/whois |
POST |
JSON |
60 request per minute |
| Parameter | Type | # | Description |
|---|---|---|---|
email |
email |
Required |
Email login |
password |
string |
Required |
Password login |
domain |
string |
Required |
Domain name |
Response
Domain is available
{
"success": true,
"domain_status": 0,
}
Domain is already registered
{
"success": true,
"domain_status": 1,
}
Error
{
"success": false,
"error": Error message,
}
Code Example
use Illuminate\Support\Facades\Http;
$result = Http::post(
'https://api.hostvn.org/api/v1/whois',
[
'email' => 'user@example.org',
'password' => 'password',
'domain' => 'example.org',
]
)->body();
1. Use GuzzleHttp
use GuzzleHttp\Client;
$client = new Client();
$result = $client->request('POST', 'https://api.hostvn.org/api/v1/whois', [
'email' => 'user@example.org',
'password' => 'password',
'domain' => 'example.org',
])->getBody();
2. Use CURL
$url = 'https://api.hostvn.org/api/v1/whois'; $param = [ 'email' => 'user@example.org', 'password' => 'password', 'domain' => 'example.org', ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, count($param)); curl_setopt($ch, CURLOPT_POSTFIELDS, $param); $result = curl_exec($ch); curl_close($ch);
$url = 'https://api.hostvn.org/api/v1/whois'; $param = [ 'email' => 'user@example.org', 'password' => 'password', 'domain' => 'example.org', ]; $response = wp_remote_post( $url, $param ); $response = wp_remote_retrieve_body($response); $result = json_decode($response, true);