<?php
// include "../tools/simple_html_dom.php";
// include "../Loghatnameh.php";
// $loghat = new Loghatnameh();
echo urlencode("سیر");
exit();
$translated = $loghat->translate("singen","DE");
// $testMessage = var_export ( $translated, true );
// file_put_contents ( "testtranslated.html", $translated, FILE_APPEND | LOCK_EX );
// $dom = new DomDocument();
// $dom->loadHTML($translated);
// $dom->loadHTMLFile("testtranslated.html");
$html = str_get_html($translated);
$tables_html = $html->find('table.innerTable');
foreach($tables_html as $table_html) {
$table = array();
foreach($table_html->find('tr') as $row)
{
$tr= array();
foreach($row->find('td') as $col){
$td = $col->plaintext;
$tr[] = $td;
}
$table[] = $tr;
}
$tables[] = $table;
}
print_r($tables);
// print_r($tables);
// $rows = $tables->item(1)->getElementsByTagName('tr');
// foreach ($rows as $row) {
// $cols = $row->getElementsByTagName('td');
// echo $cols->item(1);
// }
exit();
$classname = 'innerTable';
$finder = new DomXPath($dom);
$nodes = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' $classname ')]");
$tmp_dom = new DOMDocument();
foreach ($nodes as $node)
{
// $node[nodeValue] ;
$node;
echo "</br>";
echo "</br>";
echo "</br>";
echo "</br>";
$tmp_dom->appendChild($tmp_dom->importNode($node,true));
}
$innerHTML ="";
$innerHTML.=trim($tmp_dom->saveHTML());
// echo $innerHTML;
?>