Kullandığım şekli:
function NVITCSorgula($bilgiler = array()) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TCKimlikNoDogrula xmlns="http://tckimlik.nvi.gov.tr/WS">
<TCKimlikNo>'.$bilgiler['TCKimlikNo'].'</TCKimlikNo>
<Ad>'.$bilgiler['Ad'].'</Ad>
<Soyad>'.$bilgiler['Soyad'].'</Soyad>
<DogumYili>'.$bilgiler['DogumYili'].'</DogumYili>
</TCKimlikNoDogrula>
</soap:Body>
</soap:Envelope>',
CURLOPT_HTTPHEADER => array(
'POST: /Service/KPSPublic.asmx HTTP/1.1',
'Host: tckimlik.nvi.gov.tr',
'Content-Type: text/xml; charset=utf-8',
'SOAPAction: "http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula"',
'Cookie: TS0193588c=01e4b30442ae308bf9bb635dc7895298e8f2d382b1f484a1209cb70726a4888c12c705b7ed57df13477e3ae27f77feafa66b531bab'
),
));
$response = curl_exec($curl);
$result = simplexml_load_string($response);
$result = $result->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children()->TCKimlikNoDogrulaResponse->TCKimlikNoDogrulaResult;
if ($result == 'true') {
return true;
} else {
return false;
}
}if($participant["identityType"] == 'TC'){
$bilgiler = array(
'TCKimlikNo' => $participant["idNumber"],
'Ad' => $participant["firstName"],
'Soyad' => $participant["lastName"],
'DogumYili' => $year
);
$tc = $this->NVITCSorgula($bilgiler);
if (!$tc){
return $this->response->setJSON([
'status' => 'error',
'message' => 'TC Kimlik Numarası doğrulanamadı.'
]);
}
}