Estou com o mesmo problema, só que no meu caso estou usando Ubuntu 20.04.
Como resolver no caso do Ubuntu?
gustavo@gustavo-Spin-SP314-51:/opt/lampp/htdocs/php/8-ComposerDependencias$ php buscar-cursos.php
Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: Connection refused for URI https://www.alura.com.br/cursos-online-programacao/php in /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php:311
Stack trace:
#0 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php(230): GuzzleHttp\Handler\StreamHandler->GuzzleHttp\Handler\{closure}()
#1 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php(322): GuzzleHttp\Handler\StreamHandler->createResource(Object(Closure))
#2 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php(58): GuzzleHttp\Handler\StreamHandler->createStream(Object(GuzzleHttp\Psr7\Request), Array)
#3 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(35): GuzzleHttp\Handler\StreamHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#5 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#6 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#7 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#8 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Client.php(331): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#9 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Client.php(168): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#10 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Client.php(187): GuzzleHttp\Client->requestAsync('GET', Object(GuzzleHttp\Psr7\Uri), Array)
#11 /opt/lampp/htdocs/php/8-ComposerDependencias/buscar-cursos.php(9): GuzzleHttp\Client->request('GET', 'https://www.alu...')
#12 {main}
Next GuzzleHttp\Exception\ConnectException: Connection refused for URI https://www.alura.com.br/cursos-online-programacao/php in /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php:72
Stack trace:
#0 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(35): GuzzleHttp\Handler\StreamHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#1 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#2 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#3 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Client.php(331): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#6 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Client.php(168): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#7 /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Client.php(187): GuzzleHttp\Client->requestAsync('GET', Object(GuzzleHttp\Psr7\Uri), Array)
#8 /opt/lampp/htdocs/php/8-ComposerDependencias/buscar-cursos.php(9): GuzzleHttp\Client->request('GET', 'https://www.alu...')
#9 {main}
thrown in /opt/lampp/htdocs/php/8-ComposerDependencias/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php on line 72