jb-data.de/scripts/ajax/tanke1_clever.php
2025-08-11 22:23:30 +02:00

37 lines
No EOL
1 KiB
PHP

<?php
error_reporting(E_ALL); ini_set('display_errors',0);
$date = getdate(); $open=1;
if ($date['wday']!=0) {
if ($date['hours']<5) { $open=0; }
if ($date['hours']>22) { $open=0; }
}
if ($date['wday']==0) {
if ($date['hours']<7) { $open=0; }
if ($date['hours']>22) { $open=0; }
}
$template->assign('open', $open);
if ($open==1) {
//-------------------------------------------------------------------------------------------------------------
$page='https://www.clever-tanken.de/tankstelle_details/28391'; $child=''; $node=''; $html= '';
$tag='price-field';
$html3 = file_get_contents($page);
mb_convert_encoding($html,"UTF-8","auto");
$xp3 = new DOMDocument();
$xp3->loadHTML($html3);
$xp3 = new DOMXPath($xp3);
foreach($xp3->query("//div[@class='".$tag."']") as $node) {
$node->nodeValue;
break;
};
$children = $node->childNodes;
foreach ($children as $child) {
$tanke1 .= $child->ownerDocument->saveXML( $child );
}
}
$template->assign('tanke', $tanke1);
$template->assign('content', 'tpl/ajax/tanke.tpl');
?>