title: parsing response POST data from curl_exec call
body: <p>I have the following code block which connects out to a secure service (payment transaction gateway), passes in some fields ($postData) and receives a response ($returnValue). </p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://secure.service.com/data');
  curl_setopt($ch, CURLOPT_HEADER, true); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); 
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
  curl_setopt($ch, CURLINFO_HEADER_OUT, true);
  if ($returnValue = curl_exec($ch))
  {
      $error = curl_error($ch);
  }
  </code></pre>
  
  <p>When I display the contents of $returnValue ... they show as follows:</p>
  
  <blockquote>
    <p>HTTP/1.0 200 OK Approved Date: Wed, 10 Aug 2011 09:24:15 GMT
    Connection: close Content-Type: application/x-www-form-urlencoded
    Content-Length: 182
    avs_code=X&amp;cvv2_code=P&amp;status_code=1&amp;processor=TEST&amp;auth_code=999999&amp;settle_amount=2000&amp;settle_currency=USD&amp;trans_id=120741127516&amp;auth_msg=TEST+APPROVED&amp;auth_date=2011-08-10+09:24:15</p>
  </blockquote>
  
  <p>Is there a method or CURL call that breaks apart this result string into its component parts? or is that something I need to write myself? I need to get the response code (200), the approval/decline part (Approved) and the query string (avs_code ....). I tried looking through the curl_getinfo but that is only getting me the HTTP Response code, not the approval/decline or the query string values.</p>
  
  <p>I'm a novice at PHP so please let me know if I'm missing an obvious method call or CURL parameter.</p>