title: How to get HTTP response headers after POST request in PHP?
body: <p>I want to know if it's possible to read/parse the HTTP response header after a POST request in PHP without the use of cURL..</p>
  
  <p>I have PHP 5 under IIS7
  The code I use to POST is :-</p>
  
  <pre>
  $url="http://www.google.com/accounts/ClientLogin";
  $postdata = http_build_query(
      array(
          'accountType' => 'GOOGLE',
          'Email' => 'xxxxx@gmail.com',
          'Passwd' => 'xxxxxx',
          'service' => 'fusiontables',
          'source' => 'fusiontables query'
      )
  );
  $opts = array('http' =>
      array(
          'header'  => 'Content-type: application/x-www-form-urlencoded',
          'method'  => 'POST',
          'content' => $postdata
      )
  );
  $context  = stream_context_create($opts);
  $result = file_get_contents($url, false, $context);</pre>
  
  <p>Above, im doing a simple ClientLogin Authentication to google and I want to get the Auth token which returns in the header. Echo-ing $result only gives the body content and not headers which contains the auth token data.</p>