| 接口地址:https://tenapi.cn/v2/toutiaohotnew | 
|---|
| 返回格式:json | 
| 请求方式:get/post | 
| 请求示例:https://tenapi.cn/v2/toutiaohotnew | 
| 名称 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| - | - | - | - | 
| 名称 | 类型 | 说明 | 
|---|---|---|
| name | string | 热点标题 | 
| url | string | 热点链接 | 
{
	"code": 200,
	"msg": "success",
	"data": [{
		"name": "长沙女干部婚内出轨风波:道德底线究竟何在?聊天记录炸裂",
		"url": "https:\/\/www.toutiao.com\/article\/7367118266923237898"
	}]
}| 错误码 | 说明 | 
|---|---|
| - | - | 
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2024/5/10 07:11
 */
class freeApi
{
    private $apiUrl;
    public function __construct()
    {
        $this->apiUrl = 'https://tenapi.cn/v2/toutiaohotnew';
    }
    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}package main
import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)
const (
	APIURL   = "https://tenapi.cn/v2/toutiaohotnew"
)
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))
}