Unable to insert data into GrapheneDB using curl from PHP

91 views Asked by At

I am using GrapheneDB and I tried re-using the code which I used to use it to connect to Neo4J server from AWS server. But It is not inserting data into GrapheneDB and I have no idea what is wrong here. Previously, I used used localhost:7474 but now I'm using the following URL. How can I get it to work?

$http="http://username:[email protected]:2789/db/data/cypher/";
$data =' MERGE (a:User {name:"name",id:"id" }) ';
$data = array("query" =>$data);
$data_string = json_encode($data);
$ch = curl_init($http);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
1

There are 1 answers

0
Judit Sarmiento On

I'm Judit from GrapheneDB. The code you have shared should work. Are you maybe behind a restrictive firewall? Our instances run on non-standard ports and some firewalls block access.