I am using cURL in PHP to POST to an endpoint that is creating a resource. It returns a 201 response with a Location header giving the URL of the resource created. I also get some information in the body of the response.
What's the best way to get the plain-text body of the response, and also get the value of the location header? curl_getinfo doesn't return that header, and when I do this:
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($ch, $header) {
var_dump($header);
});
I only see one header dumped out--the "HTTP/1.1 201 Created" response code.