| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
DNSLookup.LookupHostByName
Queries the IP for domain.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| DNSLookup | 6.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "DNSLookup.LookupHostByName"; DomainName { ; Type } ) More
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| DomainName | The domain name to lookup. | "monkeybreadsoftware.com" | |
| Type | What IP type to find. Can be 4 for IPv4 or 6 for IPv6. Default is IPv4. This is currently ignored on Windows and you get back default IP type. |
4 | Optional |
Result
Returns reference number or error.
Description
Queries the IP for domain.Lookup is synchronous.
By default queries the primary IP type the machine is configured for.
Examples
Lookup domain name:
Set Variable [$q; Value:MBS( "DNSLookup.LookupHostByName"; DNS Lookup::Name to lookup; Get(ScriptParameter))]
If [MBS("IsError") = 0]
Set Field [DNS Lookup::Name; MBS( "DNSLookup.Name"; $q )]
Set Field [DNS Lookup::Addresses; MBS( "DNSLookup.Address"; $q; -1 )]
Set Field [DNS Lookup::Aliases; MBS( "DNSLookup.Alias"; $q; -1 )]
Set Variable [$r; Value:MBS( "DNSLookup.Release"; $q)]
End If
If [MBS("IsError") = 0]
Set Field [DNS Lookup::Name; MBS( "DNSLookup.Name"; $q )]
Set Field [DNS Lookup::Addresses; MBS( "DNSLookup.Address"; $q; -1 )]
Set Field [DNS Lookup::Aliases; MBS( "DNSLookup.Alias"; $q; -1 )]
Set Variable [$r; Value:MBS( "DNSLookup.Release"; $q)]
End If
Query Apple.com IPv6 values and return JSON:
Let ( [
d = MBS("DNSLookup.LookupHostByName"; "www.apple.com"; 6);
r = MBS("DNSLookup.JSON"; d);
e = MBS("DNSLookup.Release"; d)
]; r )
Example result:
{ "name": "e6858.dsce9.akamaiedge.net", "host": "www.apple.com", "aliases": [ "www.apple.com", "www-apple-com.v.aaplimg.com", "www.apple.com.edgekey.net" ], "addrtype": 30, "addressList": [ "2a02:26f0:480:182::1aca", "2a02:26f0:480:19f::1aca" ] }
d = MBS("DNSLookup.LookupHostByName"; "www.apple.com"; 6);
r = MBS("DNSLookup.JSON"; d);
e = MBS("DNSLookup.Release"; d)
]; r )
Example result:
{ "name": "e6858.dsce9.akamaiedge.net", "host": "www.apple.com", "aliases": [ "www.apple.com", "www-apple-com.v.aaplimg.com", "www.apple.com.edgekey.net" ], "addrtype": 30, "addressList": [ "2a02:26f0:480:182::1aca", "2a02:26f0:480:19f::1aca" ] }
See also
- DNSLookup.Address
- DNSLookup.Alias
- DNSLookup.JSON
- DNSLookup.LookupHostByAddress
- DNSLookup.Name
- DNSLookup.Release
- IsError
Example Databases
Blog Entries
This function checks for a license.
Created 25th November 2015, last changed 2nd September 2025