Outdated version when consulting vehicle by the board in SINESP webservice

0

Looking at looking at vehicles over the board in Git, I found a client made by Victor Torres updated with the latest version of SINESP , I 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 did not work and 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.

    
asked by anonymous 30.06.2018 / 10:16

0 answers