<?php
header('Content-Type: application/json; charset=utf-8');

$placa = "PQA4703";
$email = "rickcooder@gmail.com";
$phone = "62996494518";
$fingerprint = "t9vF262pEP0uG0oFnk5q";
$terminal = "4068707027";

// Configurações do Proxy NodeMaven
$proxy = "gate.nodemaven.com:8080";
$proxyAuth = "pkscabelim_gmail_com-country-br-ipv4-true:xcy2s9jsob";

$urlVehicle = "https://nfbti53lkd.execute-api.us-east-2.amazonaws.com/dev/site/vehicle/{$placa}?plate={$placa}&email={$email}&phone={$phone}&document=&renavam=&chassi=&uf=GO&skipDatacubeSearch=false&tpDebt=&fingerprintId={$fingerprint}";

$headers = [
    "accept: application/json, text/plain, */*",
    "origin: https://www.zignet.com.br",
    "referer: https://www.zignet.com.br/",
    "terminal: {$terminal}",
    "x-fingerprint-site-id: {$fingerprint}",
    "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"
];

$ch = curl_init($urlVehicle);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);

echo json_encode([
    "proxy_used" => $proxy,
    "status_code" => $httpCode,
    "error" => $error,
    "response" => json_decode($response, true) ?: $response
], JSON_PRETTY_PRINT);
