I can't send query cypher in server Neo4j

I tried to send query cypher to the neo4j database using PHP and I could not do it. what am I doing wrong? Here the error:

Fatal error : Uncaught GuzzleHttp\Exception\ClientException: Client error: POST http://neo4j:***@localhost:7474/db/data/transaction/commit resulted in a 415 Unsupported Media Type response in C:\Users\Ali\Desktop\Xamp\htdocs\Projet_Neo4j\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113 Stack trace: #0 C:\Users\Ali\Desktop\Xamp\htdocs\Projet_Neo4j\vendor\guzzlehttp\guzzle\src\Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 C:\Users\Ali\Desktop\Xamp\htdocs\Projet_Neo4j\vendor\guzzlehttp\promises\src\Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2 C:\Users\Ali\Desktop\Xamp\htdocs\Projet_Neo4j\vendor\guzzlehttp\promises\src\Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #3 C:\Users\Ali\Desktop\Xamp\htdocs\Projet_Neo4j\vendor\guzzlehttp\promises\src\TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{clo in C:\Users\Ali\Desktop\Xamp\htdocs\Projet_Neo4j\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113

Hello @abahhar70,
could you post the query and the headers of the HTTP POST, please?


and headers HTTP

Thank you @abahhar70
I think that I've found the solution:

415 Unsupported Media Type error occurs when the origin server refuses a particular request since the resource is in a format that is not supported by the server for the HTTP method used. This unsupported format type issue can be caused by what is defined in the resource's Content - Type or Content -Encoding headers.


I think that you're sending an application/json content
with Accept: text/html, application/xhtml+xml, application/xml header.
This is a really good reason to receive a 415 HTTP Error.

Could you try to change it in your request?

Thank you @Tobia.Moretti,
you can give a method to change his dan my request.

Hello @abahhar70,
I'm a C++/C# specialist and I didn't know well PHP and GraphAware.
My deduction based on the HTTP error, that seems to give an important info.

I think that u should be able to insert something similar at this php code

    .header("Content-type", "application/json")

and I've found this topic that maybe should help you more.

This quote is the important part of it:

Your problem is that you don't send Content-Type:application/json , that seems to only be set using function prepareRequest in GraphAware\Neo4j\Client\HttpDriver\Session

Thank you @Tobia.Moretti
I did this truk but still the same problem!!

There are some issues with the headers in the php-client. You must always define content type.

See https://github.com/graphaware/neo4j-php-client/compare/master...Nyholm:headers-fix?expand=1