The postgres SQL code for listing table names is:
select relname from pg_stat_user_tables order by relname
The PHP code to for listing table names is:
$sHost = 'localhost';
$sDatabase = 'aaaa';
$sUser = 'bbbb';
$sPassword = 'cccc';
$conn = pg_connect("host=$sHost dbname=$sDatabase user=$sUser password=$sPassword")
or die('unable to connect to database');
$q = 'select relname from pg_stat_user_tables order by relname';
$result = pg_query($conn, $q) or die ("Error in query: $q - " . pg_last_error($q));
while ($rw = pg_fetch_array($result)) {
print $rw[0] . '<br>';
}