php
$client = new \GuzzleHttp\Client();
$response = $client->post(
'http://sns.shenruxiang.com/api/v1/userFishList',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
js
const url = new URL(
"http://sns.shenruxiang.com/api/v1/userFishList"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
返回值
{
"code": 0,
"msg": "请求成功",
"data": {
"current_page": 1,
"data": [
{
"ground_id": "1【钓场id】",
"pond_id": "18【鱼塘id】",
"fish_name": "鲤鱼【鱼名】",
"fish_weight": "100.00【鱼重量】",
"fish_price": "15.00【鱼价格】",
"created_day": "2020-09-14【日期】",
"rank_id": "10【排名】",
"ground": {
"id": 1,
"name": "青鱼湾休闲垂钓园【钓场名】"
},
"ground_pond": {
"id": 18,
"name": "接口测试鱼塘【鱼塘名】"
}
},
{
"ground_id": 1,
"pond_id": 18,
"fish_name": "鲫鱼",
"fish_weight": "80.00",
"fish_price": "20.00",
"created_day": "2020-09-07",
"rank_id": "10【排名】",
"ground": {
"id": 1,
"name": "青鱼湾休闲垂钓园"
},
"ground_pond": {
"id": 18,
"name": "接口测试鱼塘"
}
}
],
"first_page_url": "https:\/\/fish.shenruxiang.com\/api\/v1\/userFishList?page=1",
"from": 1,
"next_page_url": null,
"path": "https:\/\/fish.shenruxiang.com\/api\/v1\/userFishList",
"per_page": 20,
"prev_page_url": null,
"to": 2
}
}
bash
curl -X POST \
"http://sns.shenruxiang.com/api/v1/userFishList" \
-H "Content-Type: application/json" \
-H "Accept: application/json"