分享一个whois查询PHP源代码1.0-技术论坛-技术-6KE论坛-综合开放交流论坛

分享一个whois查询PHP源代码1.0

前言

PHP源代码是我仿人皇格格的模板写的,喜欢的自己拿去开发,API免费的我会给链接

大佬勿喷

图片预览

【6ke.li】-1734826049-截屏2024-12-22 08.07.10

API地址

API链接https://jsonwhoisapi.com/

PHP代码

<?php
/*
*by pxxox(星云)
*Email pxxox@qq.com
*免费的API申请地址 https://jsonwhoisapi.com/
*/
require_once 'vendor/autoload.php';
//ID和key自己去https://jsonwhoisapi.com/获取
$customer_id = '填ID';
$api_key = '填KEY';
Unirest\Request::auth($domain, $api_key);
$headers = array("Accept" => "application/json");
$domain = isset($_GET['domain']) ? $_GET['domain'] : 'baidu.com';
$url = "https://jsonwhoisapi.com/api/v1/whois?identifier=" . $domain;
$response = Unirest\Request::get($url, $headers);
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Domain Information Lookup</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
color: #333;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
h1 {
color: #007bff;
}
input[type="text"],
select {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
font-size: 16px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
.card {
margin-top: 20px;
padding: 10px;
background-color: #f9f9f9;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="container">
<h1>域名信息查询</h1>
<form method="get">
<input type="text" name="domain" value="<?php echo htmlspecialchars($domain); ?>" placeholder="输入域名">
<input type="submit" value="查询">
</form>
<?php if ($response->code === 200): ?>
<div class="card">
<h3>WHOIS 信息</h3>
<pre><?php print_r($response->body); ?></pre>
</div>
<?php else: ?>
<p>错误: <?php echo $response->code; ?></p>
<?php endif; ?>
</div>
</body>
</html>
<?php
/*
*by                 pxxox(星云)
*Email              pxxox@qq.com
*免费的API申请地址  https://jsonwhoisapi.com/
*/
require_once 'vendor/autoload.php';
//ID和key自己去https://jsonwhoisapi.com/获取
$customer_id = '填ID'; 
$api_key = '填KEY';

Unirest\Request::auth($domain, $api_key);
$headers = array("Accept" => "application/json");

$domain = isset($_GET['domain']) ? $_GET['domain'] : 'baidu.com'; 
$url = "https://jsonwhoisapi.com/api/v1/whois?identifier=" . $domain;

$response = Unirest\Request::get($url, $headers);
?>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Domain Information Lookup</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        h1 {
            color: #007bff;
        }
        input[type="text"],
        select {
            width: 100%;
            padding: 10px;
            margin-bottom: 20px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
            font-size: 16px;
        }
        input[type="submit"] {
            width: 100%;
            padding: 10px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #0056b3;
        }
        .card {
            margin-top: 20px;
            padding: 10px;
            background-color: #f9f9f9;
            border-radius: 4px;
        }
    </style>
</head>
<body>

<div class="container">
    <h1>域名信息查询</h1>
    <form method="get">
        <input type="text" name="domain" value="<?php echo htmlspecialchars($domain); ?>" placeholder="输入域名">
        <input type="submit" value="查询">
    </form>

    <?php if ($response->code === 200): ?>
        <div class="card">
            <h3>WHOIS 信息</h3>
            <pre><?php print_r($response->body); ?></pre>
        </div>
    <?php else: ?>
        <p>错误: <?php echo $response->code; ?></p>
    <?php endif; ?>
</div>

</body>
</html>
<?php /* *by pxxox(星云) *Email pxxox@qq.com *免费的API申请地址 https://jsonwhoisapi.com/ */ require_once 'vendor/autoload.php'; //ID和key自己去https://jsonwhoisapi.com/获取 $customer_id = '填ID'; $api_key = '填KEY'; Unirest\Request::auth($domain, $api_key); $headers = array("Accept" => "application/json"); $domain = isset($_GET['domain']) ? $_GET['domain'] : 'baidu.com'; $url = "https://jsonwhoisapi.com/api/v1/whois?identifier=" . $domain; $response = Unirest\Request::get($url, $headers); ?> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Domain Information Lookup</title> <style> body { font-family: Arial, sans-serif; background-color: #f5f5f5; color: #333; } .container { max-width: 600px; margin: 0 auto; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } h1 { color: #007bff; } input[type="text"], select { width: 100%; padding: 10px; margin-bottom: 20px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; font-size: 16px; } input[type="submit"] { width: 100%; padding: 10px; background-color: #007bff; color: #fff; border: none; border-radius: 4px; cursor: pointer; } input[type="submit"]:hover { background-color: #0056b3; } .card { margin-top: 20px; padding: 10px; background-color: #f9f9f9; border-radius: 4px; } </style> </head> <body> <div class="container"> <h1>域名信息查询</h1> <form method="get"> <input type="text" name="domain" value="<?php echo htmlspecialchars($domain); ?>" placeholder="输入域名"> <input type="submit" value="查询"> </form> <?php if ($response->code === 200): ?> <div class="card"> <h3>WHOIS 信息</h3> <pre><?php print_r($response->body); ?></pre> </div> <?php else: ?> <p>错误: <?php echo $response->code; ?></p> <?php endif; ?> </div> </body> </html>

部署教程

使用 Unirest 库创建一个使用 Whois APIPHP 网页

确保您已安装【Unirest PHP库】(https://github.com/Mashape/unirest-php)。您可以使用Composer安装它

SSH安装命令:composer require mashape/unirest-php

安装好Unirest后创建一个index.php文件把上面源代码添加至文件里

API地址后台获取IDkey把文件的IDkey替换即可

© 免责声明

请登录后发表评论

    • 人皇的头像-6KE论坛-综合开放交流论坛人皇 UID:1等级-LV9-6KE论坛-综合开放交流论坛超级版主1