当前位置:网站首页>Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
2022-06-25 23:29:00 【Missed engraving sometimes】
Using the gosling cloud service API Development process , When passing a two-dimensional array , Always prompt in the background The user id list must be an array. That is, the passed parameter must be an array .
Document request standard format
{
"access_token": "xxxxxxxx",
"user_id_list": [
"u_xxxx",
"u_xxxx",
"u_xxxx"
],
"page": 1,
"page_size": 3
}
among "user_id_list" It's a two-dimensional array .
PHP Reference page
require_once __DIR__ . '/libs/Client.php';
$client = new Client();
$url = "https://api.xiaoe-tech.com/xe.user.batch_by_user_id.get/1.0.0";
$method = "post";
// Gets individual user information ;
$page_size = $_GET['page_size'];
if ($page_size == "") {
$page_size = 10;
}
$user_id_list = ['u_62b29be26704d_0cjjzuCSNk', '"u_62b2c2c2a121f_uFYhvzwnUP'];
$params = ['user_id_list' => $user_id_list, 'page' => 1, 'page_size' => $page_size];
$result = $client->request($method, $url, $params);
die(json_encode($result));
Return content
{
"req_msg":"The user id list must be an array.",
"req_code":8
}
Error page
Mocha ITOM – Request log :
Solution
take
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
It is amended as follows
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postdata));
http_build_query() Is to convert an array to url question mark ? The following parameter string , And it will be done automatically urlencode Handle .

@lockdata.cn
边栏推荐
- 指针强化与提高
- Efr32bg22 ble module (low power Bluetooth communication module) at command test
- Leetcode(435)——无重叠区间
- Somme logarithmique (deux points) pour le Groupe 52 - - e de la course de la lune blanche de niuke
- How to add cartoon characters to the blog park?
- [eosio] eos/wax signature error is_ Canonical (c): signature is not canonical
- zabbix_server配置文件详解
- Fegin client entry test
- RK3568+鸿蒙工控板工业网关视频网关解决方案
- Network security project questions of the first Henan vocational skills competition in 2022
猜你喜欢

Ue4 Ue5 combine le plug - in de reconnaissance vocale de bureau pour la reconnaissance vocale

C language (I)

konva系列教程2:绘制图形

首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千

RepOptimizer: 其实是RepVGG2

Sword finger offer 46 Translate numbers to strings (DP)

RK3568+鸿蒙工控板工业网关视频网关解决方案

After xampp restarts, the MySQL service cannot be started.

How to add cartoon characters to the blog park?

What aspects should we start with in the feasibility analysis of dry goods?
随机推荐
汇编语言核心要点
CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)
最近准备翻译外国优质文章
Live800在线客服系统:跨越时空做生意,从每次互动开始
Why is BeanUtils not recommended?
Xinchida nd04 nd04c nrf52832 (52810) ble module (low power Bluetooth communication module) at command test
首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
【opencv450-samples】inpaint 使用区域邻域恢复图像中的选定区域
Xampp重启后,MySQL服务就启动不了。
记一次beego通过go get命令后找不到bee.exe的坑
Day4 branch and loop summary and operation
Set up your own website (15)
[modulebuilder] GP service realizes the intersection selection of two layers in SDE
Network security project questions of the first Henan vocational skills competition in 2022
zabbix_ Server configuration file details
Flex & Bison Start
Flex & Bison 開始
The sum of logarithms in group 52--e of Niuke Xiaobai monthly race (two points)
Idea common plug-ins
User interaction scanner usage Advanced Edition example