RealTime LPR response

Monakhov

n3wb
Joined
Feb 3, 2017
Messages
3
Reaction score
0
Hi guys! Need help!
Can anyone explain how to get real time plate number from DS-2CD4026FWDP-IRA in text or XML via SDK or ISAPI?

I`m reading SDK, ISAPI and so on but all I can is GET requests like http://admin:admin123@192.168.0.67/ISAPI/Traffic/channels/1/vehicleDetect/plates, with response "<subStatusCode>badXmlContent</subStatusCode>"

SDK for C++ doesn`t help at all because i`m newguy in programming

maybe someone have working piece of code and can share with me or have some explanation more useful for me
 

tangent

IPCT Contributor
Joined
May 12, 2016
Messages
3,860
Reaction score
2,533
Sorry I haven't seen that documented anywhere, but the docs are a few years old. I'd suggest you stick to the term Hikvision uses "ANPR" in your searches, it might yield better results.
 
Last edited:

Monakhov

n3wb
Joined
Feb 3, 2017
Messages
3
Reaction score
0
Sorry for my language

Here we go:

1) My IPC setted for getting LPR by Alarm trigger
2) I connected button to AlarmInput

PHP:
<?php
   set_time_limit(60); //time for script exec
 
   $input_xml = '<AfterTime></AfterTime>';
   $url = "http://admin:admin123@192.168.0.67/ISAPI/Traffic/channels/1/vehicleDetect/plates";
     $array_data = array('0' => 0);
   echo '<HTML>
       <head>
           <title>ANPR</title>
           <link href="style.css" rel="stylesheet">
       </head>
       <body>
       <table><tr><th>captureTime</th><th>plateNumber</th><th>plateCountry</th></tr>'; //table head
 
    while (isset($array_data)) { //main cycle. I think its ugly((
     
       if (isset($lastNumberObject['captureTime'])) {
           $prevTime[$i] = $lastNumberObject['captureTime'];
       }   else $prevTime[$i] = 0;

       $now_day = date("Ymd");
       $now_time = date("His", time() + 3599); // I have little trouble with timezone on IPC. and i work with camera in NOW-TIME minus 1 second (while script gets result passing 1 sec)

// Next - curl options
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POSTFIELDS, "xmlRequest=" . $input_xml);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
        $data = curl_exec($ch);
        
        // Making readable result
        $array_data = json_decode(json_encode(simplexml_load_string($data)), true);
     
        //...
        $lastNumber = count($array_data['Plate'])-1;
        $lastNumberObject = $array_data['Plate'][$lastNumber];
     
        // Getting true capture time
        $capture_time = substr($lastNumberObject['picName'], 0, -1);
     
       // Checking + some magic)) and output result string by string while main cycle working
        if ($lastNumberObject['captureTime']==$now_day."T".$now_time."+0200") {             
            echo '<tr><td>'.$lastNumberObject['captureTime'].'</td><td>'.$lastNumberObject['plateNumber'].'</td><td>'.$lastNumberObject['country'].'</td><td><img src="ftp://192.168.0.109:2121/192.168.0.67/anpr-ftp/'.$capture_time.'_'.$lastNumberObject['plateNumber'].'.jpg"></td></tr>';
           break;
           flush();
           curl_close($ch);
     
       }
       }
     
// Finishing html table
    echo '</table>
       </body>
       </HTML>';

?>
This code is making HTML table whith CaptureTime, PlateNumber and PlateNumber Country in a realtime. When I press the button camera get about 20-30 identical results
If I add if checking for capture time to skip same data, script shows needed data just after full exec (set_time_limit(60))

Maybe someone can help me edit this code to work better (maybe AJAX)
 
Last edited:

rizome

n3wb
Joined
Nov 19, 2019
Messages
1
Reaction score
0
Location
UK
I`m reading SDK, ISAPI and so on but all I can is GET requests like , with response "<subStatusCode>badXmlContent</subStatusCode>"

POST for the method not get, a get will never give any content to the http server ;)

And the xml is like :

Code:
<AfterTime><picTime>0</picTime></AfterTime>
Hi can you please give more info on how you got this to work, I am trying to do exactly the same thing and I am getting the same error, I am using the following XML POST method using Postman and I am hitting the ANPR camera via the NVR:

http://<username>:<password>@192.xxx.x.xx:XXXX/ISAPI/Traffic/channels/n/vehicleDetect/plates

<?xml version:"1.0" encoding="UTF-8"?>
xmlns:"http=/www.isapi.org/ver20/XMLSchema">
<AfterTime>:
<picTime>2019-11-19T22:00:00Z</picTime>
</AfterTime>:

Response I get is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="">
<requestURL>/ISAPI/Traffic/channels/1/vehicleDetect/plates</requestURL>
<statusCode>6</statusCode>
<statusString>Invalid XML Content</statusString>
<subStatusCode>badXmlContent</subStatusCode>
</ResponseStatus>

Many Thanks!
 
Top