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));