title: AWS EC2 - Amazon Linux AMI - PHP script not working (Slim Framework)
body: <p>I've been bashing my head over and over attempting to sort out the problem with my PHP code, but to no avail. </p>
  
  <p>I'm trying to allow the user to download the .xml/.json file created from my code but it keeps destroying my page, leaving a blank, whitespace.</p>
  
  <p>Can anyone have a look and let me know where the problem is?</p>
  
  <pre><code>&lt;FORM action="MYSITE.PHP" method="get"&gt;
  &lt;BR /&gt;URL To Search: 
  &lt;INPUT type="text" name="URL" value="$requested_url"&gt; &lt;BR /&gt;
  Feedback type to receive: 
  &lt;SELECT name="Feedback"&gt;
  &lt;OPTION name=""&gt;Please Select...&lt;/OPTION&gt;
  &lt;OPTION name="XML"&gt;XML&lt;/OPTION&gt;
  &lt;OPTION name="JSON"&gt;JSON&lt;/OPTION&gt;
  &lt;/SELECT&gt;
  &lt;BR /&gt;&lt;BR /&gt;
   &lt;INPUT type="submit" value="Check this website"&gt;
  &lt;P style="color:blue"&gt;$returned&lt;/P&gt;
  &lt;P&gt;$link_count item(s) found&lt;/P&gt;
  &lt;/FORM&gt;
  &lt;/DIV&gt;
  &lt;DIV style="margin-right:5px; padding-left:5px; width:49%; float:right"&gt;
  HTMLDATA;
  
  if ($feedbackValue != "") {
   $data = array("Main URL" =&gt; $requested_url, "Sub URLs" =&gt; $returned_array);
   if ($feedbackValue == "JSON") {
    $output = htmlspecialchars(json_encode($data));
    $handler = fopen("output.json", "wb") or die('Can\'t open file');
    fwrite($handler, $output);
    fclose($handler);
   }
   else if ($feedbackValue == "XML")
   {
    $output = htmlspecialchars(xmlrpc_encode($data));
    $handler = fopen("output.xml", "wb") or die('Can\'t open file');
    fwrite($handler, $output);
    fclose($handler);
   }
   $result = &lt;&lt;&lt;HTMLDATA4
   &lt;FORM action="MYSITEOTHER.php" method="get"&gt;
   &lt;INPUT type="hidden" name="Feedback" value="$feedbackValue" /&gt;
   &lt;INPUT type="submit" value="Download File" /&gt;
   &lt;/FORM&gt;
   HTMLDATA4;
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I've got a funny feeling it's fopen, as the code won't even open a file. (JSON and XML-RPC are both enabled)</p>