微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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"}}';

?>

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐