### Bitte verwenden Sie eine VB-Version, die Tls12 unterstützt ###
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Sub EmailCheck(ByVal Email As String, ByRef credits As Integer, ByRef resulttext As String, ByRef trafficlight As String)
Dim request As WebRequest = WebRequest.Create("https://api.adresslabor.de/v1/de/check")
request.Method = "POST"
Dim postData As String = "apicid=x&apikey=x&product=EMX&email=" & Email
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
reader.Close()
dataStream.Close()
response.Close()
If responseFromServer > "" Then
Dim Pos As Integer = InStr(responseFromServer, "credits")
Dim temp As String = Mid(responseFromServer, Pos + 9, 99)
credits = Val(temp)
Pos = InStr(responseFromServer, "resulttext")
temp = Mid(responseFromServer, Pos + 13, 199)
resulttext = Strings.Left(temp, InStr(temp, Chr(34)) - 1)
Pos = InStr(responseFromServer, "trafficlight")
temp = Mid(responseFromServer, Pos + 15, 99)
trafficlight = Strings.Left(temp, InStr(temp, Chr(34)) - 1)
End If
End Sub