title: DOMXPath help needed
body: <p>I make a code that search for a specific document name (example: SZ-1000) and collect all the links what <code>div class="box"</code> contain.(<code>index.php</code>) The document name maybe contain one or two documents with an ID. (26904, 26905) It works like a charm. I get the IDs back.</p>
  
  <p>But I want to list all the attachments that links contains as links.
  The trick is now, there's no <code>div</code> element, only <code>table</code> or <code>dd</code> to specific the attachments locations.</p>
  
  <ul>
  <li>site >
  
  <ul>
  <li>document name (SZ-1000)  >
  
  <ul>
  <li>document(s) ID  >
  
  <ul>
  <li>attachments link</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>I think something wrong with that section:</p>
  
  <p><code>$xpath-&gt;query('//table[@id="content clear-block"]');</code></p>
  
  <pre><code>Catchable fatal error: Object of class DOMNodeList could not be converted to string in C:\AppServ\www\test\import.php on line 35
  </code></pre>
  
  <p>Result of <code>var_dump($articles)</code> in import.php;</p>
  
  <pre><code>object(DOMNodeList)#3 (0) { }
  object(DOMNodeList)#3 (0) { }
  </code></pre>
  
  <p>My code:</p>
  
  <blockquote>
    <p>index.php</p>
  </blockquote>
  
  <pre><code>$site = 'http://192.168.0.1:81/?q=search/node/SZ-1000';
  $html = file_get_contents($site);
  $doc = new DOMDocument();
  $doc-&gt;loadHTML($html);
  $xpath = new DOMXpath($doc);
  $articles = $xpath-&gt;query('//div[@class="box"]');
  
  $links = array();
     foreach($articles as $container) {
     $arr = $container-&gt;getElementsByTagName("a");
       foreach($arr as $item) {
        $href =  $item-&gt;getAttribute("href");
        $links[] = $href;
       }
  }
     foreach($links as $link){
       $text = end(split('/',$value));
       echo $text."&lt;br&gt;";
       $wr_out = file_get_contents("http://127.0.0.1/test/import.php?value=".$text);
       echo $wr_out;
    }
  </code></pre>
  
  <blockquote>
    <p>import.php</p>
  </blockquote>
  
  <pre><code>$value = $_GET['value'];
  $site = 'http://192.168.0.1:81/?q=node/'.$value;
  $html = file_get_contents($site);
  $doc = new DOMDocument();
  $doc-&gt;loadHTML($html);
  $xpath = new DOMXpath($doc);
  $articles = $xpath-&gt;query('//table[@id="content clear-block"]');
  
  $links = array();
     foreach($articles as $container) {
     $arr = $container-&gt;getElementsByTagName("a");
        foreach($arr as $item) {
        $href =  $item-&gt;getAttribute("href");
        $links[] = $href;
        echo $href;
       }
  }
  </code></pre>
  
  <p>Thanks for your reply!</p>
  
  <p>Edit:</p>
  
  <blockquote>
    <p>The 'Catchable fatal error: Object of class DOMNodeList could not be
    converted to string in C:\AppServ\www\test\import.php on line 35'</p>
  </blockquote>
  
  <p>error fixed:  </p>
  
  <blockquote>
    <p>echo $wr_out->tagName;</p>
  </blockquote>