<?php
$output = file_get_contents("result.html");
// echo $output;
// echo $output;
$pattern = '#<div class="text">(.*?)<\/div>#';
preg_match_all($pattern, $output, $matches);
// print_r($matches[1]);
$words= [];
$iCount = 0;
foreach($matches[1] as $match){
$iCount++;
$word = str_replace("der ","",$match);
$word = str_replace("die ","",$word);
$word = str_replace("das ","",$word);
$word = str_replace(", -"e","",$word);
$word = str_replace(", -s","",$word);
$word = str_replace(", -e","",$word);
$word = str_replace(", -"","",$word);
$word = str_replace(", -n","",$word);
$word = str_replace(", ̈e","",$word);
$word = str_replace(", -","",$word);
$word = str_replace(", e","",$word);
$word = str_replace(" -en","",$word);
$word = str_replace(" -n","",$word);
// $word = str_replace("quote;","",$match);
if($iCount%2!=0)
$words[]=$word;
}
$sql= "insert into bayadic_messages_dictionary values(itemID,messageID,userID,message,tags,messageType) VALUES ";
foreach($words as $word){
$sql.="(242342342,4234234,2423423,'".$word."','".$tags."','dictionary'),".PHP_EOL;
}
$sql = rtrim($sql,PHP_EOL);
$sql = rtrim($sql,',');
print_r($sql);