我在通过Everyman \ Neo4j执行Cypher查询时遇到了一些问题。当cURL请求被编码并发送到http://localhost:7474/db/data/cypher
时,将以HTTP 200
状态发回空响应。
我已登录终端,我可以看到neo4j-service
正在正确的端口上运行,我可以与neo4j-shell
连接并运行我正在尝试执行的Cypher。我也可以通过终端cURL到多个端点并获得有效的响应。似乎Cypher是唯一的问题。
这是卷曲配置的转储:
array(8) {
[10002]=>
string(36) "http://localhost:7474/db/data/cypher"
[19913]=>
int(1)
[42]=>
int(1)
[10023]=>
array(5) {
[0]=>
string(36) "Accept: application/json;stream=true"
[1]=>
string(30) "Content-type: application/json"
[2]=>
string(26) "User-Agent: neo4jphp/0.1.0"
[3]=>
string(14) "X-Stream: true"
[4]=>
string(19) "Content-Length: 309"
}
[10036]=>
string(4) "POST"
[47]=>
int(1)
[10015]=>
string(309) "{"query":"MATCH ..."}"
[113] => INT(1) }
我尝试重启服务并重新启动服务器但没有成功。错误日志或HTTP日志中没有任何内容。
我正在运行Neo4j社区版2.1.5。
答案 0 :(得分:0)
我在我的机器上尝试了这个,我至少回复了我发送的请求的响应:
<?php
require('vendor/autoload.php');
use Everyman\Neo4j\Cypher\Query;
$client = new Everyman\Neo4j\Client('localhost', 7534);
$queryString = "MATCH (p:Person) RETURN p LIMIT 1";
$query = new Everyman\Neo4j\Cypher\Query($client, $queryString);
$result = $query->getResultSet();
foreach ($result as $row) {
echo $row['p']->getProperty('name') . "\n";
}
然后当我运行时,这是我在ngrep中看到的输出:
T 127.0.0.1:55145 -> 127.0.0.1:7534 [AP]
POST /db/data/cypher HTTP/1.1..Host: localhost:7534..Accept: application/json;stream=true..Content-type: application/json..User-Agent: neo4jphp/0.1.0..X-Stream: true..Content
-Length: 45....{"query":"MATCH (p:Person) RETURN p LIMIT 1"}
##
T 127.0.0.1:7534 -> 127.0.0.1:55145 [AP]
HTTP/1.1 200 OK..Content-Type: application/json; charset=UTF-8; stream=true..Access-Control-Allow- Origin: *..Transfer-Encoding: chunked..Server: Jetty(9.0.5.v20130815)....486
..{"columns":["p"],"data":[[{"extensions":{},"outgoing_relationships":"http://localhost:7534/db/data/node/1/relationships/out","labels":"http://localhost:7534/db/data/node/1/
labels","traverse":"http://localhost:7534/db/data/node/1/traverse/{returnType}","all_typed_relationsh ips":"http://localhost:7534/db/data/node/1/relationships/all/{-list|&|typ
es}","self":"http://localhost:7534/db/data/node/1","property":"http://localhost:7534/db/data/node/1/properties/{key}","properties":"http://localhost:7534/db/data/node/1/prope
rties","outgoing_typed_relationships":"http://localhost:7534/db/data/node/1/relationships/out/{-list|&|types}","incoming_relationships":"http://localhost:7534/db/data/node/1/
relationships/in","create_relationship":"http://localhost:7534/db/data/node/1/relationships","paged_t raverse":"http://localhost:7534/db/data/node/1/paged/traverse/{returnType
}{? pageSize,leaseTime}","all_relationships":"http://localhost:7534/db/data/node/1/relationships/all","in coming_typed_relationships":"http://localhost:7534/db/data/node/1/rela
tionships/in/{-list|&|types}","metadata":{"id":1,"labels":["Person"]},"data": {"born":1964,"name":"Keanu Reeves"}}]]}
#####################
我和你有什么不同?