Lasso Soft Inc. > Home

[ DNS_Lookup ]

Method

[DNS_Lookup] performs a DNS query and returns the results in one of several formats. The method requires a single parameter which specifies the host name or IP address that should be looked up.

If a host name is specified then the result of the method is a preformatted string that provides all of the available DNS information for the host. If an IP address is specified then the result is an array which contains the reverse lookup host name for the address.

The -Type parameter controls what type of information about the specified host name is returned.

  • -Type='A' returns an array of IP addresses for the host name.
  • -Type='MX' returns an array of pairs each of which contains a priority and the IP address of a mail server (see also the [Email_MXLookup] tag).
  • -Type='PTR' performs a reverse lookup of an IP address, returning an array of host names (the default if an IP address is passed into the tag without a type). An empty array will be returned if no answer can be determined.

The full list of supported types include *, A, NS, MD, MF, CNAME, SOA, MB, MG, MR, NULL, WKS, PTR, HINFO, MINFO, MX, TXT. If an unsupported type is required it can be specified as an integer from 0 to 255.

Other parameters include -Class which defaults to 'IN' for Internet DNS queries. -NoRecurse which instructs the local DNS server to use a result from its cache or authoritative knowledge and not to query additional DNS servers. -Inverse performs an inverse lookup. -Status performs a status lookup.

By default the method returns an array of values if a -Type is specified (or if an IP address is passed to the tag for a reverse lookup) and a formatted result string if no -Type is specified. The -Format parameter forces all query types to return a formatted result string. -BitFormat returns the low-level data which was received from the remote server formatted for readability. -ShowResponse returns a [DNS_Response] object representing the response from the remote server which can be further manipulate.

The query which is being performed can also be inspected. The following parameters cause the [DNS_Lookup] tag to return information about what query it will perform, but the query is not actually performed. -FormatQuery returns a formatted string showing the query. -BitQuery shows the low-level data of the query formatted for readability. -ShowQuery returns a [DNS_Response] object representing the query which can be further manipulated.

Note: Lasso's DNS tags only support DNS hosts which communicate through TCP. The DNS host built into some DSL/Cable modem gateways only support UDP communications and cannot be used through Lasso. In order to use the DNS tags (and the MX lookup feature for direct sending of SMTP email) it may be necessary to specify a valid DNS host in the system network preferences.

  • Syntax
DNS_Lookup('www.example.com')

DNS_Lookup('www.example.com', -Type='A')

DNS_Lookup('www.example.com', -Type='MX')

DNS_Lookup('127.0.0.1')

DNS_Lookup('www.example.com', -Type='A', -Format)
Examples

No examples found

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft