title: Laravel XML download not right export
body: <p>I'm still learning Laravel 5.3 and am using Guzzle to connect to an API to download an already formatted xml file that I need to save to local user's pc for further usage.<br>
  I have created a download button:</p>
  
  <pre><code>    &lt;a href="{{ '/vendorOrder' }}" class="btn btn-large pull-right&gt; Download Order &lt;/a&gt;
  </code></pre>
  
  <p>I created a controller called OrderController.php:</p>
  
  <pre><code>    &lt;?php
       namespace App\Http\Controllers\edi;
  
       use Illuminate\Http\Request;
       use App\Http\Controllers\Controller;
       use GuzzleHttp\Exception\GuzzleException;
       use GuzzleHttp\Client as GuzzleHttpClient;
  
       class OrderController extends Controller
       {
            public function vendorOrder()
            {
                try {
                     $filename = 'order.xml';
                     $path = storage_path($filename)';
  
                     $client = new GuzzleHttpClient();
                     $apiRequest = $client-&gt;request('GET', 'Https://urlapi') [
                     'headers' =&gt; [
                         'Authorization' =&gt; 'Basic QVBJVGVzdFVzZXIsIFdlbGNvbWVAMTIz',
                         'ContractID' =&gt; 'aa659aa2-4175-471f',
                         'Accept' =&gt; 'text/xml'
                     ],
                     ]);
  
                 $content = ($apiRequest-&gt;getBody()-&gt;getContents());
  
                 return response::download(file_put_contents($path, $content), '200', [
                 'Content-Type' =&gt; 'text/xml',
                 'Content-Disposition' =&gt; 'attachment; filename="'.$filename.'"'
               ]);
  
                } catch (RequestException $re) {
                   echo $re;
                }
             }
         }
  </code></pre>
  
  <p>and the route:</p>
  
  <pre><code>    Route::get('/vendorOrder', 'edi\OrderController@vendorOrder');        
  </code></pre>
  
  <p>I'm able to connect just fine, and the contents of the xml display just fine  when I use: </p>
  
  <pre><code>    return response($content, '200')-&gt;header('content-type', 'text/xml');
  </code></pre>
  
  <p>however when I use: </p>
  
  <pre><code>    return response::make(file_put_contents($path, $content), '200', [
              'Content-Type' =&gt;  'text/xml',
              'Content-Disposition' =&gt; 'attachment; filename="'.$filename.'"'
          ]);
  </code></pre>
  
  <p>as in controller above, I'm able to download a file called order.xml (as expected) but the contents is just a single number ie "1179866".  No xml tags or the xml content or anything else - just the number.</p>
  
  <p>Any help would be appreciated</p>