Outdated version when looking for vehicle by the plate in the SINESP web service

Asked

Viewed 833 times

0

Looking for about consulting vehicles by board in Git, I found a client made by Victor Torres updated with the latest version of SINESP, tried to convert to PHP and got the following code:

<?php
$placa = $_GET['placa'];
$chave = '#8.1.0#Mw6HqdLgQsX41xAGZgsF';
$token = hash_hmac('sha1', $placa, implode('', unpack('C*', $placa.$chave)));
$latitude = ((20000/111000.0 * sqrt(rand(1,1000))) * cos(2 * 3.141592654 * rand(1,1000)) + -15.7942287);
$longitude = ((20000/111000.0 * sqrt(rand(1,1000))) * sin(2 * 3.141592654 * rand(1,1000)) + -47.8821658);
$data = date('Y-m-d h:i:s');
$request = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><b>motorola XT1069</b><c>ANDROID</c><d>8.1.0</d><e>4.1.1</e><f>{0}.{1}.{2}.{3}</f><g>'.$token.'</g><h>'.$latitude.'</h><i>'.$longitude.'</i><k></k><l>'.$data.'</l><m>8797e74f0d6eb7b1ff3dc114d4aa12d3</m></soap:Header><soap:Body><webs:getStatus xmlns:webs="http://soap.ws.placa.service.sinesp.serpro.gov.br/"><a>'.$placa.'</a></webs:getStatus></soap:Body></soap:Envelope>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://cidadao.sinesp.gov.br/sinesp-cidadao/mobile/consultar-placa/v3');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['User-Agent: ksoap2-android/2.6.0+', 'SOAPAction: ', 'Content-Type: text/xml;charset=utf-8', 'Host: cidadao.sinesp.gov.br', 'Connection: Keep-Alive', 'Accept-Encoding: gzip']);
echo curl_exec($ch);

But it didn’t work and it returns:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getStatusResponse xmlns:ns2="http://soap.ws.placa.service.sinesp.serpro.gov.br/"><return><codigoRetorno>7</codigoRetorno><mensagemRetorno>Versão desatualizada. Favor atualizar aplicativo.</mensagemRetorno></return></ns2:getStatusResponse></soap:Body></soap:Envelope>

Does anyone have any idea how to fix it? Thank you.

  • ai in the documentation has use with PHP

  • 1

    You are using an unofficial system, based on data capture simulating an application, and that has not been updated for at least 5 months. It is expected that it does not work. To "fix" you have to reverse engineer the current SINESP application and update such "client".

  • 2

    And the conversion to PHP has already been done, in a quick search I found this one: https://github.com/chapeupreto/sinesp

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.