我想实现电话号码验证,检查电话号码是否存在。
我做了这个
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
但这只是运营商查找,它不会检查实际电话号码是否存在。