Skip to content
Andrew Lambert edited this page Jan 14, 2023 · 10 revisions

Remarks

libcURL supports custom DNS servers and overriding the DNS resolver for specific hostnames.

Example

Override the resolver

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"
  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

Custom DNS server

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
Clone this wiki locally