文字转语音朗读
其他 官方文档
文字转语音朗读
基本说明:
接口地址:https://api.oick.cn/txt/apie.php
返回格式:mp3
请求方式:get
请求示例:https://api.oick.cn/txt/apiz.php?text=免费api做免费接口的搬运工&spd=1
请求参数说明:
名称 类型 必填 说明
text string 必填 输入要转换的文字或英文
spd int 必填 语速,可以是1-9的数字,数字越大,语速越快
返回参数说明:
名称 类型 说明
- - -
JSON返回示例:
暂无
服务级错误码参照
错误码 说明
- -
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2021/11/09 09:08
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://api.oick.cn/txt/apiz.php?text=免费api做免费接口的搬运工&spd=1';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "https://api.oick.cn/txt/apiz.php?text=免费api做免费接口的搬运工&spd=1"
)

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))
}