0

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:password@hobby-1312.dbs.graphenedb.com: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);
seantomburke
  • 10,514
  • 3
  • 18
  • 23
jason
  • 3,932
  • 11
  • 52
  • 123
  • What is the response you are getting from Neo4j? Can you add the http response code and the response body? – William Lyon Dec 22 '16 at 19:28
  • How do I do that ? – jason Dec 22 '16 at 19:46
  • I have added : $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($result, 0, $header_size); $body = substr($result, $header_size); And I get 0 as the response – jason Dec 22 '16 at 19:53

1 Answers1

0

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.