title: PHP cURL: Read a specific response header
body: <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>    curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($ch, $header) {
          var_dump($header);
      });
  </code></pre>
  
  <p>I only see one header dumped out--the "HTTP/1.1 201 Created" response code.</p>