電話番号が存在するかどうかをチェックする電話番号検証を実装したいと考えています。
これは私がしました
Imports Twilio.Lookups
If Not File.Exists("list.txt") Then
MsgBox("insert phone numbers to list.txt")
Return
Else
Dim list() As String = File.ReadAllLines("list.txt")
ListBox1.Items.AddRange(list)
End If
Dim accountSid As String = "AC862c52baff7d8ef72c9e4c04f828fa03"
Dim authToken As String = "xxxxxxxxxxxx"
Dim lookups As New LookupsClient(accountSid, authToken)
For Each str4 In ListBox1.Items
Dim phoneNumber = lookups.GetPhoneNumber(str4, True)
If ((((Not phoneNumber.Carrier Is Nothing) AndAlso (Not phoneNumber.Carrier.Name Is Nothing)) AndAlso ((Not phoneNumber.NationalFormat Is Nothing) AndAlso (Not phoneNumber.PhoneNumber Is Nothing))) AndAlso (Not phoneNumber.CountryCode Is Nothing)) Then
Console.WriteLine(phoneNumber.Carrier.Name)
ElseIf (Not phoneNumber.RestException Is Nothing) Then
Console.WriteLine(phoneNumber.RestException.Message)
Else
Console.WriteLine("Phone number was correct, although the carrier who owns it was not found.")
End If
Next
ただし、これはキャリアの検索のみを行い、実際の電話番号が存在するかどうかは確認しません。