title: How can I query my HTML using this jQuery expression?
body: <p>I'm processing HTML and I need to query a particular subset of it, but I only know how to do this easily with jQuery selectors.</p>
  
  <p>Here's my PHP code:</p>
  
  <pre><code>$words = array('word');        
  $baseUrl = 'http://lema.rae.es/drae/srv/search?val='; //word goes at the end        
  $resultIndex = 0;
  
  foreach($words as $word) {
      if (!isset($_REQUEST[$word]))
          continue;
      $contents = file_get_contents($baseUrl . urldecode(utf8_decode($_REQUEST[$word])));
  
      // THIS DOESN'T WORK! HOW DO I WRITE THIS IN PHP
      $dataineed = $contents.find(".ul a").attr("href"); 
  
      $contents = preg_replace('/(search?[\d\w]+)/','http://lema.rae.es/drae/srv/',     $contents);
  
      echo "&lt;div id='results' style='
        //style
       ", (++$resultIndex) ,"'&gt;", $dataineed, $contents,
          "&lt;/div&gt;";
  }
  </code></pre>
  
  <p>The query I would use in jQuery is this:</p>
  
  <pre><code>.find(".ul a").attr("href")
  </code></pre>
  
  <p>How can I write that using PHP and DOM?</p>