Fetch
await fetch("https://api.example.com/users", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
body: "{\"name\":\"CLIS\"}"
});
Axios
axios({
url: "https://api.example.com/users",
method: "post",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer token"
},
data: "{\"name\":\"CLIS\"}"
});
Python
import requests
response = requests.request(
"POST",
"https://api.example.com/users",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer token",
},
data="{\"name\":\"CLIS\"}"
)
print(response.text)
PHP
$ch = curl_init("https://api.example.com/users");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer token",
],
CURLOPT_POSTFIELDS => "{\"name\":\"CLIS\"}"
]);
$response = curl_exec($ch);
curl_close($ch);
Go
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://api.example.com/users", strings.NewReader("{\"name\":\"CLIS\"}"))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer token")
resp, err := client.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
Java
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.example.com/users"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer token")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"name\":\"CLIS\"}"))
.build();cURL 转多语言请求代码是 CLIS.CC 按常用在线工具使用习惯整理的小工具,适合在浏览器中快速完成数据格式化、编码解码、文本整理、配置转换、单位换算和代码片段生成。工具默认采用左侧输入、右侧输出的一屏结构,常用选项集中在输入区顶部,输入内容后会即时生成结果,不需要额外跳转页面,也不会打断原有编辑流程。
从 cURL 命令生成 fetch、Axios、Python、PHP、Go、Java 示例。在实际使用中,你可以把接口返回、配置文件、URL 参数、文本列表或样式片段直接粘贴到输入区,再根据需要调整处理方式。右侧结果区保持纯文本展示,方便选择、滚动和复制,适合开发调试、运营整理、SEO 文案处理、文档排版和日常办公场景。