【问题标题】:Unable to insert data into GrapheneDB using curl from PHP无法使用 PHP 的 curl 将数据插入 GrapheneDB
【发布时间】:2016-12-22 16:16:57
【问题描述】:

我正在使用 GrapheneDB,我尝试重新使用我用来从 AWS 服务器连接到 Neo4J 服务器的代码。但它没有将数据插入 GrapheneDB,我不知道这里出了什么问题。以前,我使用过localhost:7474,但现在我使用的是以下 URL。我怎样才能让它工作?

$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);

【问题讨论】:

  • 您从 Neo4j 得到的回应是什么?可以添加http响应码和响应体吗?
  • 我该怎么做?
  • 我已添加:$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($result, 0, $header_size); $body = substr($result, $header_size);我得到 0 作为响应

标签: php curl neo4j graphenedb


【解决方案1】:

我是来自 GrapheneDB 的 Judit。您共享的代码应该可以工作。您可能在限制性防火墙后面吗?我们的实例在非标准端口上运行,一些防火墙阻止访问。

【讨论】:

    猜你喜欢
    • 2012-06-23
    • 1970-01-01
    • 2012-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多