Hi,
I am running language tool on localhost,
I used to deal with only text in the beginning and this CURL PoST method would work just fine:
function post_request($text, $language_code, $ignored_rules) {
$data = “text=$text&language=$language_code&disabledRules=$ignored_rules”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “http://localhost:8082/v2/check”);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/x-www-form-urlencoded’));
//curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Accept: application/json’));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
dpm($result);
if(!curl_errno($ch)){
$data = json_decode($result);
}
return $data;
}
But I am dealing eith HTML now and I have created a json object separating markup from text.
Eg : {“annotation”:[ {“text”: "A "}, {“markup”: “<b>”}, {“text”: “test”}, {“markup”: “</b>”} ]}
I am unable to send the post request succesfully.
Every time it gives me an error saying Internal Error: null
Can you help me please?