@mzagmajster, thank you for your response. As far as I know Mautic 4 no longer has the Basic Auth option, only OAuth 2.
I have Composer on my VPS and have no problem using it, but it is stuck on a Mautic bug. Attempts history here.
Previously reported Composer bug here.
Can you echo out curl_error so we see what actually goes wrong?
I have no clue where to do that, but am pretty sure what goes wrong is 1) I can’t connect because Mautic 4 does not have Basic Auth and 2) there is no /api/ directory in my installation, which is probably part of the fabled PHP API library that can only be installed via the magical Composer that fails on an unsolved Mautic bug.