沫延说
沫延说
API

Topstalk API

Topstalk现免费提供API接口供全宇宙使用

调用方式如下:

获取信息类:

获取基础信息:

调用地址:https://tools.topstalk.com/Api/GetInfo.php

调用方式:

GET

支持参数(区分大小写):

Date

Time

IPAddress

调用示例:

::获取公网IP并存入文件IPAddress.txt中
@echo off
curl --insecure https://tools.topstalk.com/Api/GetInfo.php?IPAddress -o IPAddress.txt -#
#!/bin/bash

ip=$(curl -s --insecure https://tools.topstalk.com/Api/GetInfo.php?IPAddress)
echo "My public IP address is: $ip"

 

 

获取Cloudflare CDN节点:

调用地址:https://tools.topstalk.com/Api/GetCloudflareCDNIP.php

调用方式:

GET

支持参数(区分大小写):

无需参数

调用示例:

<?php
$url='https://tools.topstalk.com/Api/GetCloudflareCDNIP.php';
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$timeout=5;
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$IP_Section=curl_exec($ch);
file_put_contents("CloudflareCDNIP.txt" , $IP_Section , LOCK_EX);
curl_close($ch);