返回值演示:

1
2
3
4
5
6
7
8
9
{
"code": "200",
"host": "192.168.1.1",
"ip": "192.168.1.1",
"location": "局域网 对方和您在同一内部网",
"ping_time_min": " 0.371ms",
"ping_time_avg": "0.381ms",
"ping_time_max": "0.392ms"
}

API源码:

1
2
3
4
5
6
7
8
9
10
11
12
<?php
/**
*域名/IP Ping
*2019-03-07
*NiceHanBlog
*https://www.vvhan.com/article/pingapi.html
*/
header("Content-Type:text/html;charset=UTF-8");
$url = $_GET['url'];
$result = file_get_contents("http://api.vvhan.com/ping?host=".$url);
echo $result;
?>