|
|
Search for the specified record.
Syntax
object.Search( [Keyword],
[SearchType] )
Remarks
The Search method submits the specified keyword and type
of search to the server. The data returned by the server can be
read using the Read method. Note that the text returned by a
UNIX based server may only contain linefeeds at the end of each
line of text, rather than the standard carriage return/linefeed
used on Windows systems.
- Keyword
- An optional string which specifies the keyword to search for.
Typically this is the name of a domain, user handle or an e-mail
address. If this argument is omitted, the value of the
Keyword property is used as the default value.
- SearchType
- An optional integer value which specifies the type of search to
perform. If this argument is omitted, the value of the
SearchType property is used as the default value. One of the
following search types may be specified:
| Value
|
Constant
|
Description
|
| 1 |
whoisSearchAny |
Search for any value that matches the given
keyword value |
| 2 |
whoisSearchHandle |
Search for a handle that matches the given
keyword value |
| 3 |
whoisSearchName |
Search for a user name that matches the given
keyword value |
| 4 |
whoisSearchMailbox |
Search for a user mailbox that matches the
given keyword value |
Return Value
A value of zero is returned if the method was successful.
Otherwise, a non-zero error code is returned which indicates the
cause of the failure.
Example
The following example demonstrates how to use the Search
method:
Dim strBuffer As String, strResults As String
Dim nRead As Long, nError As Long
' Connect to the InterNIC server and submit a search for the
' Internet Engineering Task Force (IETF) domain
nError = WhoisClient1.Connect("whois.internic.net")
If nError = 0 Then
nError = WhoisClient1.Search("ietf.org", whoisSearchAny)
End If
' If an error occurs, display a message box and exit
If nError <> 0 Then
MsgBox WhoisClient1.LastErrorString, vbExclamation
Exit Sub
End If
' Read the data returned by the server and store it in
' a string buffer named strResults
Do
nRead = WhoisClient1.Read(strBuffer, 2048)
If nRead < 1 Then Exit Do
strResults = strResults + strBuffer
Loop
' If there was an error reading the data, then report
' it to the user
If nRead = -1 Then
MsgBox WhoisClient1.LastErrorString, vbExclamation
End If
' Disconnect from the server
WhoisClient1.Disconnect
See Also
Keyword Property,
SearchType Property,
Connect Method, Read
Method
|
|