2021'de kullandığım test kod bloğunu paylaşıyorum umarım işinize yarar;
$giris = '<kullaniciAdi>'.$this->ApiUserName.'</kullaniciAdi>
<sifre>'.$this->ApiUserPass.'</sifre>';
$islemXml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:uet="http://uetds.unetws.udhb.gov.tr/">
<soapenv:Header/>
<soapenv:Body>
<uet:kimlikDogrulama>
<!--Optional:-->
<wsuser>
'.$giris.'
</wsuser>
<!--Optional:-->
<kimlikBilgileriInput>
<kimlikNo>'.$tc.'</kimlikNo>
<adi>'.$ad.'</adi>
<soyadi>'.$soyad.'</soyadi>
</kimlikBilgileriInput>
</uet:kimlikDogrulama>
</soapenv:Body>
</soapenv:Envelope>'
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"Content-length: ".strlen($islemXml),
);
$result = UETDSCurl($islemXml,$headers);
function UETDSCurl($islemXml,$headers) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->ApiUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $islemXml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_TIMEOUT,10);
curl_setopt($ch, CURLOPT_USERPWD, $this->ApiUserName . ":" . $this->ApiUserPass);
$response = curl_exec($ch);
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpStatusCode==200) {
return $response;
} else {
return false;
}
}Kodun en düz haline çevrilmişi bu mantığını anlaman için bu şekle getirdim