public function parseByURL($url_base, $titel, $id)
 {
     echo "Lese ein: " . $titel . "\n";
     $index = ris_download_string($url_base . "/css/" . $id . "_index.htm");
     preg_match("/gLastPage = (?<seiten>[0-9]+);/siu", $index, $matches);
     $seiten = $matches["seiten"];
     if (!$seiten || $seiten < 1) {
         throw new Exception("Konnte Seitenzahl nicht auslesen");
     }
     $texte = "";
     $css = "";
     for ($seite = 1; $seite <= $seiten; $seite++) {
         $document = ris_download_string($url_base . "/css/" . $id . "_" . $seite . ".htm");
         // workaround for https://bugs.php.net/bug.php?id=61484
         ini_set('mbstring.substitute_character', "none");
         $document = mb_convert_encoding($document, 'UTF-8', 'UTF-8');
         $x = explode('<!-- text starts here -->', $document);
         $x = explode('</BODY>', $x[1]);
         $text = $x[0];
         $html = str_replace(["<NOBR>", "</NOBR>", "<SPAN", "</SPAN"], ["", "", "<DIV", "</DIV"], $text);
         preg_match("/text positioning information \\*\\/\\n(?<css>.*)<\\/STYLE/siu", $document, $matches);
         $x = explode('* text positioning information */', $document);
         $x = explode('/* bitmap image information */', $x[1]);
         $css_src = $x[0];
         $x = explode("\n", $css_src);
         foreach ($x as $y) {
             if (substr($y, 0, 3) != ".ps" && substr($y, 0, 3) != ".ft") {
                 continue;
             }
             $css .= ".seite" . $seite . " " . $y . "\n";
         }
         $texte .= '<section class="seite seite' . $seite . '">' . $html . '</section>' . "\n\n\n";
     }
     $titel = html_entity_decode($titel, ENT_COMPAT, "UTF-8");
     /** @var Rechtsdokument $rechtsdokument */
     if ($id > 0) {
         $rechtsdokument = Rechtsdokument::model()->findByAttributes(["id" => $id]);
     } else {
         $rechtsdokument = Rechtsdokument::model()->findByAttributes(["titel" => $titel]);
     }
     if (!$rechtsdokument) {
         $rechtsdokument = new Rechtsdokument();
     }
     $rechtsdokument->url_base = $url_base;
     $rechtsdokument->url_html = $url_base . "/css/" . $id . ".htm";
     $rechtsdokument->url_pdf = $url_base . ".pdf";
     $rechtsdokument->id = $id > 0 ? $id : rand(100000, 999999);
     $rechtsdokument->titel = $titel;
     $rechtsdokument->html = $texte;
     $rechtsdokument->css = $css;
     $rechtsdokument->save();
 }