Unable to create deal - Getting Status code - 415

I tried to search in community for get same issue but didn’t get solutions for my issue.
While creating deal or contact i’m getting 415 status code while it get success using postman api call . Below i mention my curl call please help me asap to resolve it.

$headers = array(‘Content-Type: application/json’,‘Cache-Control: no-cache’);
if (count($extraHeader)){
$headers = array_merge($headers, $extraHeader);
}

$ch = @curl_init();
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if ($type == ‘post’) {
@curl_setopt($ch, CURLOPT_POST, TRUE);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
} else if ($type == ‘put’) {
@curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “PUT”);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
} else {
@curl_setopt($ch, CURLOPT_POST, FALSE);
}
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HEADER, true);
@curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
@curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
// if (in_array($_SERVER[‘REMOTE_ADDR’], array(‘127.0.0.1’))) {
// curl_setopt($ch, CURLOPT_PROXY, ‘192.168.10.5:8080’);
// }
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = @curl_exec($ch);
$status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
createLog(‘Curl Error’, $curl_errors, $logObj);
createLog(‘Curl Status code’, $status_code, $logObj);
@curl_close($ch);
$response = json_decode($response);
createLog(‘RESPONSE’, $response, $logObj);

return json_encode(array(“response” => $response, “status” => $status_code));

Hey @testuser27 ,

Thanks for adding your question here!

Could you please let us know what the endpoint you are trying to reach is as well as the complete URL that you are using (xxx for hapikey if necessary!).

Also, I realize you said it is working in postman, but could you also include an example of the json body that you are using?

@himanshurauthan , @Jsum !

Do you have any thoughts on where the error is in this cURL script

Thanks!!

d