Skip to content

Instantly share code, notes, and snippets.

@ufukcaneski
Created August 17, 2022 18:15
Show Gist options
  • Save ufukcaneski/5261424574a386363a8b688659e1f9c5 to your computer and use it in GitHub Desktop.
Save ufukcaneski/5261424574a386363a8b688659e1f9c5 to your computer and use it in GitHub Desktop.
Vergi Kimlik Numarası Doğrulama ile şirket ünvanı bilgisini alma
function curl($url, $data)
{
/* Init cURL resource */
$ch = curl_init($url);
/* pass encoded JSON string to the POST fields */
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
/* execute request */
$result = curl_exec($ch);
/* close cURL resource */
curl_close($ch);
return $result;
}
public function token()
{
$postdata = http_build_query(
array(
'assoscmd' => 'cfsession',
'rtype' => 'json',
'fskey' => 'intvrg.fix.session',
'fuserid' => 'INTVRG_FIX'
)
);
$data = curl('https://ivd.gib.gov.tr/tvd_server/assos-login', $postdata);
return $data;
}
public function vkn_verification()
{
$vkn = '1111111'; // vergi kimlik numaranız
$vd = '111111'; // vergi dairesi kodunuz
$il = '001; // il kodunuz
$token = json_decode($this->token());
$jp = json_encode(array(
"dogrulama" => array(
"vkn1" => $vkn,
"tckn1" => "", // eğer şahıs şirketiyseniz vkn1'i boş bırakıp tckn1'i doldurunuz.
"iller" => $il,
"vergidaireleri" => $vd
)
));
$postdata = http_build_query(
array(
'cmd' => 'vergiNoIslemleri_vergiNumarasiSorgulama',
'callid' => 'ff81dd010b12d-8',
'pageName' => 'R_INTVRG_INTVD_VERGINO_DOGRULAMA',
'token' => $token->token,
'jp' => $jp
)
);
$data = curl('https://ivd.gib.gov.tr/tvd_server/dispatch', $postdata);
print_r($data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment