title: Why doesn't this php crawler work?
body: <h2>In my localhost document root:</h2>
  
  <p>crawl.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;p&gt;
  &lt;form action="welcome.php" method="get"&gt;
  Site to crawl: &lt;input type="text" name="crawlThis"&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;
  &lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>welcome.php</p>
  
  <pre><code> &lt;html&gt;
   &lt;body&gt;
  
   &lt;?php 
   include ("crawler.php");
  
   echo $crawl = new Crawler($_GET["crawlThis"]);
  
   $images = $crawl-&gt;get("images");
  
   $links = $crawl-&gt;get("links"); 
  
   echo $links;
   echo $images;
  
   ?&gt;
   &lt;br&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>and crawler.php</p>
  
  <pre><code>&lt;?php
  
  class Crawler {
  
  protected $markup = '';
  
  public function __construct($uri) {
  
  $this-&gt;markup = $this-&gt;getMarkup($uri);
  
  }
  
  public function getMarkup($uri) {
  
  return file_get_contents($uri);
  
  }
  
  public function get($type) {
  
  $method = "_get_{$type}";
  
  if (method_exists($this, $method)){
  
  return call_user_method($method, $this);
  
  }
  
  }
  
  protected function _get_images() {
  
  if (!empty($this-&gt;markup)){
  
  preg_match_all('/&lt;img([^&gt;]+)\/&gt;/i', $this-&gt;markup, $images);
  
  return !empty($images[1]) ? $images[1] : FALSE;
  
  }
  
  }
  
  protected function _get_links() {
  
  if (!empty($this-&gt;markup)){
  
  preg_match_all('/&lt;a([^&gt;]+)\&gt;(.*?)\&lt;\/a\&gt;/i', $this-&gt;markup, $links);
  
  return !empty($links[1]) ? $links[1] : FALSE;
  
  }
  
  }
  
  }
  
  
  /*$crawl = new Crawler($);
  
  $images = $crawl-&gt;get('images');
  
  $links = $crawl-&gt;get('links');*/
  
  ?&gt;
  </code></pre>
  
  <p>Result page is just empty.
  Can't figure out if I just can't echo $images, or if my logic is wrong. 
  I'm expecting a list of images, and then a list of links.</p>
  
  <p>Also, do I have to include crawler.php or will php search its container directory for a class of the same name?</p>
  
  <p>Sorry, coming to PHP from Java is a bit of a mindscrew.</p>