# Content type detection for rest requests is deprecated 5.4

**URL:** <https://discuss.elastic.co/t/content-type-detection-for-rest-requests-is-deprecated-5-4/91709>\
**Category:** Elasticsearch\
**Created:** [July 4, 2017, 3:29am UTC](https://discuss.elastic.co/t/content-type-detection-for-rest-requests-is-deprecated-5-4/91709 "2017-07-04T03:29:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dilip\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dilip_kumar/32/15459_2.png) [@Dilip\_Kumar](https://discuss.elastic.co/u/Dilip_Kumar)\
**Post date:** [July 4, 2017, 3:29am UTC](https://discuss.elastic.co/t/content-type-detection-for-rest-requests-is-deprecated-5-4/91709/1 "2017-07-04T03:29:14Z")

</div>

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;

```

}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 1, 2017, 3:29am UTC](https://discuss.elastic.co/t/content-type-detection-for-rest-requests-is-deprecated-5-4/91709/2 "2017-08-01T03:29:28Z")

</div>

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