Connect to Retool Database via PHP (PG or PDO)

Hi All,

I'm trying to connect a PHP script to my Retool database, but I cannot to get it working.
However, I can using pgAdmin on my computer using the connection string provided. I followed this thread, and came up with this bit of code just to try the connection is working

$conn_string = " dbname=retool user=retool password=myPassword sslmode=require options=endpoint=ep-tiny-salad-94170773";
$dbconn = pg_connect($conn_string);
if (!$dbconn) echo "Connection failed.";
else echo "Connection successful.";

This gives me the folowing error:

pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "" ( and accepting TCP/IP connections on port 5432?

Am I missing some configuration here? Some mistake in the the connection string? Do you have a working example?

Thanks in advance for any help you could provide.

Just got in touche whith my hosting provider.
Remote connections are blocked on their side...

Guess I'll have to work my way around on another tool ...