0

这是我写的代码。有关 Web 服务的更多信息,请访问https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?op=TCKimlikNoDogrula

Function tckimlik(ad As String, soyad As String, tckn As Double, dy As Integer) As String
Dim responseText As String
    Dim sURL As String
    Dim sEnv As String
    Dim xmlhtp As New MSXML2.XMLHTTP
    Dim xmlDoc As New DOMDocument
    Dim startPos, endPos, openTag, closeTag, startTagPos, sid As String
    sURL = "http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula"
    sEnv = "<?xml version=""1.0"" encoding=""utf-8""?>"
    sEnv = sEnv & "<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/"">"
    sEnv = sEnv & " <soap:Body>"
    sEnv = sEnv & "<TCKimlikNoDogrula xmlns=""http://tckimlik.nvi.gov.tr/WS""> "
    sEnv = sEnv & "<TCKimlikNo>"
    sEnv = sEnv & tckn
    sEnv = sEnv & "</TCKimlikNo>"
    sEnv = sEnv & "<Ad>"
    sEnv = sEnv & ad
    sEnv = sEnv & "</Ad>"
    sEnv = sEnv & "<Soyad>"
    sEnv = sEnv & soyad
    sEnv = sEnv & "</Soyad>"
    sEnv = sEnv & "<DogumYili>"
    sEnv = sEnv & dy
    sEnv = sEnv & "</DogumYili>"
    sEnv = sEnv & " </TCKimlikNoDogrula>"
    sEnv = sEnv & " </soap:Body>"
    sEnv = sEnv & "</soap:Envelope>"

With xmlhtp
        .Open "post", sURL, False
        .setRequestHeader "Host", "tckimlik.nvi.gov.tr"
        .setRequestHeader "Content-Type", "text/xml; charset=utf-8"
        .setRequestHeader "soapAction", "http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula"
        .send sEnv
        xmlDoc.LoadXML .responseText
        responseText = .responseText
    End With
tckimlik = responseText


End Function

谢谢

4

0 回答 0