• 21-07-2022, 18:39:58
    #1
    Merhaba arkadaşlar,

    https://tckimlik.nvi.gov.tr/Service/...imlikNoDogrula şurada servis paylaşımı yapılmış. Aşağıdaki şekilde uygulayıp bilgileri giriyorum. olusturdugum php dosyasını açtığımda Doğrulama başarısız diyor. Nerede hata yapıyor olabilirim?

    <meta charset="utf-8">
    <?php
        function tcno_dogrula($bilgiler){
    
            $gonder = '<?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>long</TCKimlikNo>
          <Ad>string</Ad>
          <Soyad>string</Soyad>
          <DogumYili>int</DogumYili>
        </TCKimlikNoDogrula>
      </soap:Body>
    </soap:Envelope>';
    
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL,            "https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx" );
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
            curl_setopt($ch, CURLOPT_POST,           true );
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_HEADER, FALSE);
            curl_setopt($ch, CURLOPT_POSTFIELDS,    $gonder);
            curl_setopt($ch, 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"',
            'Content-Length: '.strlen($gonder)
            ));
            $gelen = curl_exec($ch);
            curl_close($ch);
    
            return strip_tags($gelen);
        }
    
    $bilgiler = array(
    "isim"      => "",
    "soyisim"   => "",
    "dogumyili" => "",
    "tcno"      => ""
    );
    
    $sonuc = tcno_dogrula($bilgiler);
    
    if($sonuc=="true"){
    echo "Doğrulama başarılı";
    }else{
    echo "Doğrulama başarısız";
    }
    ?>
  • 21-07-2022, 18:49:14
    #2
    Fonksiyonda $bilgiler argümanı var ama kullanmamışsınız, dokümanda bulunan mavi yazılı kısımları değerler ile değiştirmeniz gerekiyor.