Hi,
I am new with php and rest and i keep getting the following error ->
"message" : "You have to provide the 'query' parameter.",
when i try to pass a query through rest.Here is my code below.
...............................................
<?php
$URL = "
http://localhost:7474/db/data/cypher";
$data = '{ "query" : "START person=node:Person(name = \'Anakin\') RETURN
person",
"params" : {}}';
var_dump(json_decode($data));
var_dump(json_decode($data, true));
function processCurlJsonrequest($URL,$data) { //Initiate cURL request
and send back the result
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADERS, array('Content-Type:
application/json'));
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POST, true);
$results = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
}
return $results;
}
print_r(processCurlJsonrequest($URL, $data));
?>