I’m using curl to do post request, for some reason it prints xml response, which is something that I don’t want to happend. how can I get rid of this behaviour?
/**
* Send post request
**/
function post_request($sendHttpUrl, $data) {
$ch = curl_init($sendHttpUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
You’ve set the RETURNTRANSFER flag on the wrong variable. Alter
$curlto$ch.