Current Location: Home> Function Categories> socket_addrinfo_lookup

socket_addrinfo_lookup

Get an array of getaddrinfo content about the given hostname
Name:socket_addrinfo_lookup
Category:Sockets
Programming Language:php
One-line Description:Get an array containing getaddrinfo content about the given hostname

(PHP 7 >= 7.2.0, PHP 8)

socket_addrinfo_lookup — Gets an array containing getaddrinfo content about the given hostname

illustrate

 socket_addrinfo_lookup(string $host, ?string $service = null, array $hints = []): array|false

Find different ways to connect to host. The returned array contains a list of AddressInfo instances, which can be bound using socket_addrinfo_bind().

parameter
host
The hostname of the search.

service
The service to connect to. If service is a string number, it is specified as the port number. Otherwise, the specified network service name will be mapped to the corresponding port by the operating system.

Hints
Hints provides criteria for selecting a return address. Can be specified as a hints structure defined by getaddrinfo.

Returns the AddressInfo instance array that can be used with other socket_addrinfo functions. Returns false on failure.

Update log
Version illustrate
8.0.0 When successful, the function now returns the AddressInfo instance array. Before this, the resource array is returned.
8.0.0 service is now allowed to be null.

Similar Functions
Popular Articles