Join 2,000+ others and never miss out on new tips, tutorials, and more.
pecl install openswoole-4.11.1
The URL you want to parse and get the host and port for.
Returns the host and port from the URL, if a UnixSocket is used, only the host is returned, so port will be 0 if a socket is used.
This is a static method used to parse the given URL through the PHP
parse_url method and get the host and port components.
Note: This method is more for internal usage with the client but it is made public for you as some situations may benefit from it.
<?php // IP Address [$host, $port] = Swoole\Coroutine\FastCGI\Client::parseUrl('127.0.0.1:9000'); var_dump($host, $port); // UnixSocket [$host, $port] = Swoole\Coroutine\FastCGI\Client::parseUrl('unix://tmp/php-fpm.sock'); var_dump($host, $port);