V
V
Vladimir Golub2018-02-18 01:44:49
PHP
Vladimir Golub, 2018-02-18 01:44:49

RESTful API to work with PostgreSQL other than ArrestDB?

Advise ready REST Full API for work with PostgreSQL?
Trying https://github.com/alixaxel/ArrestDB.
Error 403 crashes. I
connect using PDO to the database

<?php
    $user = 'vladimir';
    $pass = '';

    try {
    $dbh = new PDO('pgsql:host=localhost;dbname=jkh', $user, $pass);
    foreach($dbh->query('SELECT * from test') as $row) {
    print_r($row);
    }
    $dbh = null;
    } catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
    }
?>

I get the answer: Array ( [id] => 2 [0] => 2 [name] => Test record 2 [1] => Test record 2 ) Array ( [id] => 1 [0] => 1 [name ] => Test entry 1 [1] => Test entry 1 )
Trying to set parameters in the API
$dsn = 'pgsql://[email protected]/jkh/';

$clients = array
(
    '127.0.0.1',
    '127.0.0.2',
    '127.0.0.3',
);

I get an error - 403
{
"error": {
"code": 403,
"status": "Forbidden"
}
}
Tried the same for MySQL, also error 403
$dsn = 'mysql://root:[email protected]/portaldb/' ;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
YaRobot, 2018-02-18
@YaRobot

How are Postgresql and rest related?
RESTful is implemented on any framework. And without, if you have hands.
For example, here are some lessons .
Again, for PHP, 4k repositories
https://github.com/topics/restful?utf8=✓&q=laravel...
And you're just trying to connect to the database.
Read about rest.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question