title: How to use TLS 1.2 in Visual Basic 6 (vb6) - REST
body: <p><a href="https://apigee.com/api-management/" rel="nofollow noreferrer">APIGee</a> is migrating the request to TLS 1.2</p>
  
  <p><strong>OS: Windows Server 2003 !!!</strong></p>
  
  <p>I have an old application developed in vb6, but it stopped working because of this new migration</p>
  
  <p>Here is my code</p>
  
  <pre><code>Public Function GetCustomerName(ByVal pCPFCliente As String) As String
      Dim xmlhttp As MSXML2.ServerXMLHTTP
      Set xmlhttp = New MSXML2.ServerXMLHTTP
  
  
      xmlhttp.Open "GET", const_URL &amp; "/customer=" &amp; pCPFCliente &amp; "&amp;identification.type=CPF", False
      xmlhttp.setRequestHeader "Content-Type", "application/json"
      xmlhttp.setRequestHeader "Authorization", const_TOKEN
      xmlhttp.send
  
      Dim objJson As Object
      Set objJson = JSON.parse(xmlhttp.responseText)
      Dim lacoRecord As Integer
      Dim customerName As String
      customerName = ""
  
      If xmlhttp.Status = 200 Then
          For lacoRecord = 1 To objJson.Item("records").Count
              customerName = objJson.Item("records")(lacoRecord).Item("name")
          Next
      ElseIf xmlhttp.Status = 404 Then
          If objJson.Item("errorCode") = 20023 Then
              Call WriteLogManual("CONSULTA CPF", "Cliente não encontrado! " &amp; pCPFCliente, pPedido, 0, 0, 0, 0, 0)
          Else
              Call WriteLogManual("CONSULTA CPF", "Erro ao consultar CPF " &amp; pCPFCliente &amp; " - " &amp; xmlhttp.responseText, pPedido, 0, 0, 0, 0, 0)
          End If
      ElseIf xmlhttp.Status = 503 Then
          MsgBox "Ocorreu um erro 503 ao buscar o CPF do Cliente na API. " &amp; Chr(13) &amp; xmlhttp.responseText
          Call WriteLogManual("CONSULTA CPF", "Erro ao consultar saldo na ApiGee - " &amp; xmlhttp.responseText, pPedido, 0, 0, 0, 0, 0)
      Else
          MsgBox "Ocorreu um erro ao buscar o saldo do Cliente na API. " &amp; Chr(13) &amp; xmlhttp.responseText
          Call WriteLogManual("CONSULTA CPF", "Erro ao consultar saldo na ApiGee - " &amp; xmlhttp.responseText, pPedido, 0, 0, 0, 0, 0)
      End If
  
      GetCustomerName = customerName
  End Function
  </code></pre>