Content type detection for rest requests is deprecated 5.4

I am using simple php curl to post data, but getting "Content type detection for rest requests is deprecated." in log. Please help to solve the issue.

$es_response = geturl($api_es, 'post', 'true', $json_esData);

function geturl($url, $method = 'get', $header = null, $postdata = null, $new = false, $timeout = 15)
{

$s = curl_init();

curl_setopt($s, CURLOPT_URL, $url);

if ($header) {
    //curl_setopt($s, CURLOPT_HTTPHEADER, $header);
	curl_setopt($s, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($postdata)));
	//'Content-Type: application/json','Content-Length: ' . strlen($postdata),));

}

curl_setopt($s, CURLOPT_TIMEOUT, $timeout);
curl_setopt($s, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($s, CURLOPT_MAXREDIRS, 5);
curl_setopt($s, CURLOPT_RETURNTRANSFER, true);
curl_setopt($s, CURLOPT_FOLLOWLOCATION, true);

if (strtolower($method) == 'post') {
    curl_setopt($s, CURLOPT_POST, true);
    curl_setopt($s, CURLOPT_POSTFIELDS, $postdata);
} else if (strtolower($method) == 'delete') {
    curl_setopt($s, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt($s, CURLOPT_CUSTOMREQUEST, 'DELETE');
} else if (strtolower($method) == 'put') {
    curl_setopt($s, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($s, CURLOPT_POSTFIELDS, $postdata);
}

curl_setopt($s, CURLOPT_SSL_VERIFYPEER, false);

$html = curl_exec($s);
 
curl_close($s);
return $html;

}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.