title: XML Response Echoing to Screen Instead of Returning to Variable
body: <p>I have some PHP code, including an XML-generating and sending class that allows my business partners to send me information.  It's working like a dream, except for the response. It keeps printing the XML response to the screen.</p>
  
  <p>Their PHP page (which I'm in control of), generates and sends (via CURL POST) the XML to my site's receiving PHP page, which processes the data (correctly) and echos an XML Success/Error response.  Even though I've tried capturing the response in a class variable or just returning it into a variable from their PHP page, it keeps showing the XML Response on the page and that won't work, it just needs to be processed programmatically.</p>
  
  <p>Business Partner's PHP:</p>
  
  <pre><code>$hbn = new hbnXML;
  $hbn-&gt;UpdateType = "Update";
  $hbn-&gt;Populate($hbnData);
  
  //echo "creating base&lt;br&gt;";
  $hbn-&gt;createXMLBase();
  //echo "createing XML&lt;br&gt;";
  $hbn-&gt;createXML();
  //echo "sending XML&lt;br&gt;";
  $result = $hbn-&gt;sendXML();
  // i want to process $result here
  //echo "RESULT: $result&lt;br&gt;";
  </code></pre>
  
  <p>Pertinent class fxn:</p>
  
  <pre><code>   function sendXML(){
          $url = "http://mywebsite.com/receiveXML";
      //setting the curl parameters.
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      // Following line is compulsary to add as it is:
      curl_setopt($ch, CURLOPT_POSTFIELDS,
                  "xmlRequest=" . html_entity_decode($this-&gt;xml, ENT_COMPAT, 'UTF-8'));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
      curl_setopt($ch, CURLOPT_TIMEOUT, 120);
      $result = curl_exec($ch);
              if (!$result) {
                  echo "&lt;p&gt;cURL error number: " .curl_errno($ch) . " on URL: " . $url ."&lt;/p&gt;" . "&lt;p&gt;cURL error: " . curl_error($ch) . "&lt;/p&gt;";
              }
              if($result &amp;&amp; $result != "Success"){
                 print $result;
              }
      curl_close($ch);
      return $result;
  </code></pre>
  
  <p>}</p>
  
  <p>receiveXML.php: line that prints XML response</p>
  
  <pre><code>if($update_id){
     header("Content-type: text/xml; charset=utf-8");
     echo genXMLResponse("Success",null);
  }
  </code></pre>