title: PHP Classes and Curl
body: <p>To my smartest friends, I googled and tried everything. I am sure that this is just the late night not letting me see/understand the problem. I should mention that I am still in the process of switching to OOP from functional, and I this is my first time I was able to have curl enabled. :( So, feel free to critique any bad practices also..</p>
  
  <pre><code>&lt;?php
  class urlValidation
  {
      public $content;
      public $validUrl;
      public function __construct($validUrl)
      {
          $this-&gt;content = $content;
          $this-&gt;validUrl = $validUrl;
          $this-&gt;getContents();
      }
      public function getContents()
      {
          $this-&gt;curlHandler = curl_init($this-&gt;validUrl);
          curl_setopt($this-&gt;curlHandler, CURLOPT_NOBODY, false);
          curl_setopt(CURLOPT_RETURNTRANSFER, false); //changing false to true is the answer!
          $this-&gt;content = curl_exec($this-&gt;curlHandler);
          curl_close($this-&gt;curlHandler);
      }
  }
  ?&gt;
  </code></pre>
  
  <p>called from</p>
  
  <pre><code>$suggestUrl = 'http://www.google.com';
  $validate = new urlValidation($suggestedUrl);
  </code></pre>
  
  <p>For all of the best of me, I cannot figure out why $this->content prints to the screen without being called. I just simply want that returned HTML to be stored in a variable and not returned/printed/appended to the document.</p>