接口地址:https://www.boredapi.com/api/activity/ |
---|
返回格式:json |
请求方式:get |
请求示例:https://www.boredapi.com/api/activity/ |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
- | - | - | - |
名称 | 类型 | 说明 |
---|---|---|
- | - | - |
{
"activity": "Take a spontaneous road trip with some friends",
"accessibility": 0.3,
"type": "social",
"participants": 4,
"price": 0.2,
"link": "",
"key": "2085321"
}
错误码 | 说明 |
---|---|
- | - |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2020/02/01 12:33
*/
//----------------------------------
// 随机活动 调用类
//----------------------------------
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://www.boredapi.com/api/activity/';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}