Would anybody know of a fairly generic way of getting the IP addresses
of a site, (ipv4 and ipv6 when available), while protecting myself from timeouts.
You have to write your own function that will build a UDP packet to
query a DNS server, call the socket_set_timeout() function to set a
timeout value, send the UDP packet, and hope that you get a response.
An example of how you can do this is located at php.net: