300万高清车牌识别一体机Http推送
作者:互联网
搭建PHP服务器,阿里云虚拟Web空间有限制频繁发送数据的策略,WAMP在Windows下即可。分别建立路径:
/devicemanagement/php/receivedeviceinfo.php;
/devicemanagement/php/plateresult.php;
/devicemanagement/php/gio.php;
/devicemanagement/php/serial.php
300万高清车牌识别一体机设置见图:
plateresult.php源代码
<?php $doc = file_get_contents("php://input"); $fp = fopen("snap_shot.txt", "w"); if(!$fp){ return; } $flag=fwrite($fp, $doc); //$flag=fwrite($fp, $jsondecode['AlarmInfoPlate']['result']['PlateResult']['imagePath']); if(!$flag) { fclose($fp); return; } fclose($fp); $jsondecode = json_decode($doc,true); if($jsondecode == null){ return; } // 小图片 if(isset($jsondecode['AlarmInfoPlate']['result']['PlateResult']['imageFragmentFile'])) { $small_image = $jsondecode['AlarmInfoPlate']['result']['PlateResult']['imageFragmentFile']; if( $small_image != null){ $fs_image = fopen("smallimage.jpg", "w"); if(!$fs_image){ return; } $simage_decoded = base64_decode($small_image); $flag2=fwrite($fs_image, $simage_decoded); fclose($fs_image); } } // 大图片 if(isset($jsondecode['AlarmInfoPlate']['result']['PlateResult']['imageFile'])) { $image = $jsondecode['AlarmInfoPlate']['result']['PlateResult']['imageFile']; if( $image != null){ $fp_image = fopen("image.jpg", "w"); if(!$fp_image){ return; } $image_decoded = base64_decode($image); $flag=fwrite($fp_image, $image_decoded); fclose($fp_image); } } $license = $jsondecode['AlarmInfoPlate']['result']['PlateResult']['license']; $fp_license = fopen("license.txt", "w"); if($fp_license ) { $flag=fwrite($fp_license , $license ); fclose($fp_license); } // 发送开闸命令 //echo '{"Response_AlarmInfoPlate":{"info":"ok","content":"...","is_pay":"true"}}'; ?>
receivedeviceinfo.php源代码
<?php echo '{"heartbeat":{"countid":158,"timeStamp":{"Timeval":{"sec":1571932096,"usec":0}},"serialno":"e0fade1063f0fe93"}}'; ?>
标签:一体机,源代码,Http,300,devicemanagement,receivedeviceinfo,php 来源: https://www.cnblogs.com/zhouein/p/14347980.html