on the way to read status_noauth
authorChristian Weiske <cweiske@cweiske.de>
Tue, 14 Dec 2010 19:23:35 +0000 (20:23 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 14 Dec 2010 19:23:35 +0000 (20:23 +0100)
Wrt3g/HtmlParser.php

index fe81c586ef1421d25eab8243574bfd0011ac9ca1..246cb6f3d5d9d953eea57fb2b3aeeaeb244fef7f 100644 (file)
@@ -114,5 +114,35 @@ class Wrt3g_HtmlParser
      */
     public function status_noauth($body)
     {
+        $body = str_replace(
+            array('&nbsp;', '</font>', '<script>', '</script>'),
+            '', $body
+        );
+        //var_dump($body);die();
+        $doc = new DomDocument();
+        libxml_use_internal_errors(true);//html is broken
+        $doc->loadHtml($body);
+               $xpath = new DOMXPath($doc);
+               $trs = $xpath->query('//table//table/tbody/tr');
+        foreach ($trs as $tr) {
+            /*
+            var_dump(
+                '--------',$doc->saveXML($tr),
+                $xpath->query('td', $tr)->length);
+            */
+            $titleItems = $xpath->query('td[@width=125]/text()', $tr);
+            $valueItems = $xpath->query('td[@width=296]/*[1]', $tr);
+            if ($titleItems->length && $valueItems->length) {
+                $title = $titleItems->item(0);
+                $value = $valueItems->item(0);
+            
+                var_dump(
+                    $doc->saveXML($title) . "\n"
+                    . $doc->saveXML($value) . "\n\n"
+                );
+            }
+        }
+
+        $arMatches = array();
     }
 }
\ No newline at end of file