-
-
Notifications
You must be signed in to change notification settings - Fork 11
DNS Example
Andrew Lambert edited this page Jun 18, 2021
·
10 revisions
libcURL supports custom DNS servers and overriding the DNS resolver for specific hostnames.
This example specifies a custom IP address that will be used instead of a DNS lookup for a specific hostname.
Dim dns As New libcURL.ListPtr
Dim host, IP As String
host = "www.example.com:80"
IP = "192.168.1.4"
Call dns.Append(host + ":" + IP)
Dim curl As New cURLClient
Call curl.SetOption(libcURL.Opts.RESOLVE, dns)
If Not curl.Get("http://www.example.com/") Then
MsgBox(libcURL.FormatError(curl.LastError))
End If
This example specifies a list of custom DNS server addresses that will be used instead of the default DNS:
Dim dns As String = "192.168.1.100,192.168.1.101,3.4.5.6" ' comma delimited
Dim curl As New cURLClient
Call curl.SetOption(libcURL.Opts.DNS_SERVERS, dns)
If Not curl.Get("http://www.example.com/") Then
MsgBox(libcURL.FormatError(curl.LastError))
End If
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.