前言
此PHP
源代码是我仿人皇格格的模板写的,喜欢的自己拿去开发,API
是免费的我会给链接
大佬勿喷
图片预览
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 API
的 PHP
网页
确保您已安装【Unirest PHP
库】(https://github.com/Mashape/unirest-php
)。您可以使用Composer
安装它
SSH
安装命令:composer require mashape/unirest-php
安装好Unirest
后创建一个index.php
文件把上面源代码添加至文件里
API
地址后台获取ID
和key
把文件的ID
和key
替换即可
© 免责声明
本帖子内容由用户发布,仅代表发帖人观点,与6ke论坛立场无关。我们不对任何用户生成内容的准确性、完整性、适用性或合法性做出保证。使用本信息的风险由您自行承担。如发现违法违规内容,请立即联系我们。详情请参阅完整的用户协议和隐私协议。