Arkadaşlar kodum şu şekilde, ne yaptıysam sonuç değerini alamadım, yardımcı olacaklara teşekkürler.

 

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);




$cookie = "COOKIE.TXT";

$url = "https://www.turkiye.gov.tr/imei-sorgulama?submit";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, "https://www.turkiye.gov.tr/");
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 

curl_setopt($ch, CURLOPT_VERBOSE, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);

$headers = array(
    "X-Custom-Header: header-value",
    "Content-Type: application/json"
);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
//curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');



$response = curl_exec($ch);

preg_match('@<input type="hidden" name="token" value="(.*?)" />@si',$response,$token);
echo $token[1];
$post = [
    'txtImei' => '357237030805067',
    'token' => $token[1],
];
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 





echo curl_exec($ch);