Assuming you do not need authentication, the simplest thing would be to have an index.php in link and you could query it do it by ajax or directly, for example: link (and follow) ...
In the index.php you take the values you expect to receive.
You create the connection to your database, you perform the query, in a loop you receive the rows and the loads in a vector.
This vector should be structured correctly so that at the end you can return it using the function "json_encode ($ vector)".
An extremely simple code would be the following:
// manejador de base de datos
require('db_api.php');
// recibo el parametro
$param1 = $_GET["parametro1"] ?? '';
// array para almacenar los elementos a retornar
$items = array();
// objeto con el cual manejo las consultas a mi tabla usuarios
$dbh = new DB_Usuarios_Tbl();
// esta función "setea" la consulta y limpia los datos recibidos
$dbh->leerDatos($param1);
// voy recibiendo las filas
while($row = $dbh->db_fetch_row()){
$items[] = $row;
}
// retorno el resultado
print json_encode( $output );
This would be the simplest, the ideal would be a REST service with authentication.
There are bookstores for that.
I hope it helps you to have an idea.