if ($_POST['value'] == '111'){
$arr = array(
'Телефон: ' => $_POST['phone'],
'Замовлені товари: ' => $products,
);
$txt = "";
foreach($arr as $key => $value) {
if (is_array($value)) {
$txt .= "<b>".htmlentities($key)."</b> ".htmlentities(implode(", ", $value))."%0A";
} else {
$txt .= "<b>".htmlentities($key)."</b> ".htmlentities($value)."%0A";
}
};
$sendToTelegram = fopen("https://api.telegram.org/bot{$token_xtz}/sendMessage?chat_id={$chat_id_xtz}&parse_mode=html&text={$txt}","r");
}
while read -r domain; do
if [ -n "${domain}" ]; then
expdate=$(whois "${domain}" | grep -iE 'expir.*date|expir.*on|expires|free-date' | head -1 | grep -oE '[^ ]+$')
new_expdate="-"
day_left="-"
if [ -n "${expdate}" ]; then
new_expdate=$(echo "${expdate}" | sed 's/T.*//')
expdate=$(date -d "${expdate}" "+%s")
curdate=$(date "+%s")
day_left=$(((expdate-curdate)/86400))
fi
if [ "${day_left}" -lt 0 ]; then
echo "For '${domain}' lease already expired at '${new_expdate}'"
else
echo "For '${domain}' lease expires at '${new_expdate}', '${day_left}' days left"
fi
fi
done < domain.list