门禁设备使用该接口,在本人(第三方平台)向人脸识别终端或人脸识别门禁终端调用该接口后,上报人员透传记录。
调用方向:
人脸识别终端或人脸识别门禁终端向第三方平台调用API。
请求描述:
请求方法: POST请求URL: /LAPI/V1.0/System/Event/Notification/PersonVerification内容类型:文本/纯文本
请求示例:
{
"Reference": "204.2.1.20:5118/LAPI/V1.0/System/Event/Subscription/0",
"Seq": 5,
"DeviceCode": "210235C3R13202000093",
"Timestamp": 1564735558,
"NotificationType": 1,
"FaceInfoNum": 1,
"FaceInfoList": [
{
"ID": 5,
"Timestamp": 1564707615,
"CapSrc": 1,
"FeatureNum": 0,
"FeatureList": [
{
"FeatureVersion": "",
"Feature": ""
},
{
"FeatureVersion": "",
"Feature": ""
}
],
“Temperature”: 36.5,
“MaskFlag”: 1,
"PanoImage": {
"Name": "1564707615_1_86.jpg",
"Size": 101780,
"Data": "…"
},
"FaceImage": {
"Name": "1564707615_2_86.jpg",
"Size": 35528,
"Data": "…"
},
"FaceArea": {
"LeftTopX": 4981,
"LeftTopY": 3744,
"RightBottomX": 8250,
"RightBottomY": 5583
}
}
],
"CardInfoNum": 0,
"CardInfoList": [ ],
"GateInfoNum": 0,
"GateInfoList": [ ],
"LibMatInfoNum": 1,
"LibMatInfoList": [
{
"ID": 5,
"LibID": 3,
"LibType": 4,
"MatchStatus": 2,
"MatchPersonID": 0,
"MatchFaceID": 0,
"MatchPersonInfo": {
"PersonName": "",
"Gender": 0,
"CardID": "",
"IdentityNo": ""
}
}
]
}
我正在使用Laravel,当我尝试$ dump( $request->getContent() );
->all()时得到[],下面当我请求dump时得到[]
似乎我需要从请求的开头和结尾去掉""
以便json_decode(),但是无论我使用什么字符串函数- preg_replace、substring等-都没有改变,当我尝试$content时,我得到了{
而不是"
,$content-1我得到了\n
,$content-2我得到了}
有谁能指出我哪里错了吗?
发布于 2020-09-11 21:05:50
看起来这就是Content-Type
头的问题。但它应该是一个适当的解决方案:
$find = ['/"""/', '/\\\n/', '/“/', '/”/'];
$replace = ['', '', '"', '"'];
$output = preg_replace($find, $replace, $your_input);
// now the $output is ready to be decoded
$decoded = json_decode($output);
$v = var_dump($decoded);
有关实际实现,请参阅此Repl:Json Parse
https://stackoverflow.com/questions/63845177
复制相似问题