判斷域名過期時間
define(
"NOTIFY_DAYS"
, 90);
define(
'EMAIL'
,
'name@domain.com'
);
$domains
=
array
(
'domain1.com'
,
'domain2.com'
,
);
function
alert(
$domain
)
{
mail(EMAIL,
'Domain Expire Waring - '
.
$domain
, sprintf(
"%s will expired in %s days"
,
$domain
, NOTIFY_DAYS));
}
function
check_doamin_expire(
$domain
)
{
exec
(sprintf(
"/usr/bin/whois %s"
,
$domain
),
$arr
,
$retCode
);
if
(
$retCode
== 0)
{
$exp_date
=
array_values
(preg_filter(
'/^Registrar Registration Expiration Date:\s*(.+)$/'
,
"$1"
,
$arr
));
if
((
strtotime
(
$exp_date
[0]) - time()) < NOTIFY_DAYS*86400)
{
alert(
$domain
);
}
}
}
foreach
(
$domains
as
$domain
)
{
check_doamin_expire(
$domain
);
}
推薦文章
2025-01-18
2024-11-28
2024-11-09
2024-10-25
2024-06-25
2024-01-04
2023-11-06
2023-10-30
2023-10-13
2023-10-10
穩定
產品高可用性高并發貼心
項目群及時溝通專業
產品經理1v1支持快速
MVP模式小步快跑承諾
我們選擇聲譽堅持
10年專注高端品質開發