İyi kullanımlar
Kod:
<?php
// API URL
header("Content-Type: application/json; utf-8;");
$token ="6a0d981d14ba51fa25a2ea72822e3e567e40b1022e7725f77487a43d36317b81734777ecd29a473bf8cc88dc5e3a53502f79658899fd2d736dc8e1eb11709b6e";
$tc = $_GET['plaka'];
$url = 'https://ivd.gib.gov.tr/tvd_server/dispatch';
// Veri
$data = array(
'cmd' => 'motopDetayCariLoginOncesi_motopDetaylariCari',
'callid' => 'b32de2aab44ee-8',
'pageName' => 'P_INTVRG_INTVD_MOTOP_SORGULA',
'token' => "$token",
'jp' => json_encode(array(
'vknTckn' => '24446542450',
'plaka' => $tc,
'ozelPlaka' => '0',
'tescilTarihiGun' => '18',
'tescilTarihiAy' => '11',
'tescilTarihiYil' => '2022',
'sposEkranTipi' => '0'
))
);
// Curl isteği oluşturma
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$headers = array(
'Accept: application/json, text/javascript, /; q=0.01',
'Accept-Language: en-US,en;q=0.9',
'Connection: keep-alive',
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
'Origin: https://ivd.gib.gov.tr',
"Referer: https://ivd.gib.gov.tr/tvd_side/main.jsp?token=$token",
'Sec-Fetch-Dest: empty',
'Sec-Fetch-Mode: cors',
'Sec-Fetch-Site: same-origin',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
'sec-ch-ua: "Not/A)Brand";v="99", "Google Chrome";v="115", "Chromium";v="115"',
'sec-ch-ua-mobile: ?0',
'sec-ch-ua-platform: "Windows"'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// CURL isteğini gerçekleştirme
$response = curl_exec($ch);
// CURL isteğini kapatma
curl_close($ch);
// Yanıtı güzel bir şekilde formatla
$a = json_decode($response, true);
$b = array("data" => $a["data"]);
echo json_encode($b, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
/*
$prettyResponse = json_encode($jsonResponse, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
// Yanıtı ekrana yazdır
echo $prettyResponse;
*/
?>