Hi,
The idea is to add a proxy on the neo4j REST API containing the database credentials.
You can do something like this in php:
<?php
// Customize headers to allow the query
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: content-type");
header("Content-Type: application/json");
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'POST') {
// Get the json query data
$request_body = file_get_contents('php://input');
$protocol = 'https';
$host = 'your.neo4j.host';
$port = '7474';
$curlQuery = curl_init($protocol . '://' . $host . ':' . $port . '/db/data/transaction/commit');
curl_setopt($curlQuery, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curlQuery, CURLOPT_POSTFIELDS, $request_body);
curl_setopt($curlQuery, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlQuery, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Basic base64EncodedUser:Password' // For example Base64 encoded value of "neo4j:password" is "bmVvNGo6cGFzc3dvcmQ="
)
);
echo curl_exec($curlQuery);
}