Calling local LT server from php

I have been trying to invoke the new json api using php with curl, but no success. Only response I get is 'missing ‘text’ or data parameter, while I am supplying those in a post.

Does anyone have a working example for me?

This works for me:

     $url = "https://languagetool.org/api/v2/check";
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, "language=auto&text=".urlencode($text));
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($ch);
     $json = json_decode($response);

Just replace the value for $url to use a local server.