有道翻译
暂无简介
总调用次数:0
今日调用:0
返回格式:application/json
接口地址
https://api.shiqisx.top/API/fanyi.php
请求参数
该接口暂无请求参数
返回码说明
暂无返回码说明
该接口无需填写参数,可直接请求
返回结果
点击「请求」按钮,查看接口返回结果
多语言调用示例
cURL
curl -X GET "https://api.shiqisx.top/API/fanyi.php"
Python
import requests
url = "https://api.shiqisx.top/API/fanyi.php"
response = requests.get(url)
print(response.text)
PHP
<?php
$url = "https://api.shiqisx.top/API/fanyi.php";
$result = file_get_contents($url);
echo $result;
?>
JavaScript
// 使用 fetch 发送GET请求
const url = 'https://api.shiqisx.top/API/fanyi.php';
fetch(url)
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error('请求失败:', err));
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ApiRequest {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String url = "https://api.shiqisx.top/API/fanyi.php";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.GET()
.build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
}
}
Go
package main
import (
"fmt"
"net/http"
"net/url"
"io/ioutil"
)
func main() {
baseUrl := "https://api.shiqisx.top/API/fanyi.php"
parsedUrl, _ := url.Parse(baseUrl)
q := parsedUrl.Query()
parsedUrl.RawQuery = q.Encode()
resp, err := http.Get(parsedUrl.String())
if err != nil {
fmt.Println("请求失败:", err)
return
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
C#
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
var url = new Uri("https://api.shiqisx.top/API/fanyi.php");
var response = await client.GetAsync(url);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
Shell
# 使用curl发送GET请求
curl -X GET "https://api.shiqisx.top/API/fanyi.php"
词库
# Secluded/QRspeed/ClousX6
A:$访问 https://api.shiqisx.top/API/fanyi.php$
Kotlin
import okhttp3.OkHttpClient
import okhttp3.Request
fun main() {
val client = OkHttpClient()
val url = "https://api.shiqisx.top/API/fanyi.php"
val request = Request.Builder()
.url(url)
.get()
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw RuntimeException("请求失败: ${response.code}")
println(response.body?.string())
}
}