title: PHP Encoding and Decoding HTML as Binary
body: <p>The database I am using is Postgresql and I downloading a webpage and storing in a BLOB. Like this:</p>
  
  <pre><code>&lt;?php
  $html = file_get_contents('http://www.example.com');
  $encoded_html = base64_encode($html);
  
  //Store encoded data in blob in database
  ?&gt;
  </code></pre>
  
  <p>That part works fine. But when I try to decode it and display it, it comes out garabled.</p>
  
  <pre><code>&lt;?php echo base64_decode($encoded_html); ?&gt;
  </code></pre>
  
  <p>Do I have to add extra parameters when encoding and decoding the data?</p>