接口地址:https://test.harumoe.cn/api/other/ping |
---|
返回格式:json |
请求方式:get |
请求示例:https://test.harumoe.cn/api/other/ping?ip=inis.cc&port=80&timeout=10&lang=zh-cn |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
ip | string | 选填 | ip |
port | int | 选填 | 端口 |
timeout | int | 选填 | 超时时间 |
lang | string | 选填 | 语言类型(zh-cn、ru-ru、en-us、ja-jp、ko-kr) |
名称 | 类型 | 说明 |
---|---|---|
ip | string | ip |
port | int | 端口 |
ping | int | 超时时间 |
domain | string | 域名 |
{
"code": 200,
"msg": "数据请求成功!",
"data": {
"ping": "25 ms",
"ip": "106.14.122.20",
"domain": "free-api.com",
"port": "80"
}
}
错误码 | 说明 |
---|---|
- | - |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2023/06/05 14:26
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://test.inis.cn/api/other/ping?ip=inis.cc&port=80&timeout=10&lang=zh-cn';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://test.inis.cn/api/other/ping?ip=inis.cc&port=80&timeout=10&lang=zh-cn"
)
func main() {
queryUrl := fmt.Sprintf("%s",APIURL)
resp, err := http.Get(queryUrl)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}