New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Kimsufi KS3 availability checker and notifier [PHP]
Kimsufi DC availability checker and notifier [PHP]
run it with crontab every minute
<?php
$sms_api = "SMS NOTIFY API URL HERE";
$my_file = 'lock.txt';
$f = fopen("$my_file", "r");
$data = fgets($f);
if (strpos($data,'locked') === false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.kimsufi.com/en/order/kimsufi.cgi?hard=150sk30&dedicatedQuantity=1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
if (strpos($response,'Le paramètre est invalide') !== false) {
//dedicated not available
echo 'not available';
}else {
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
fwrite($handle, 'locked');
//notify by sms
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$sms_api");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
}
}else {echo 'locked';}
?>
Thanked by 1inthecloudblog
Comments
Can you put this on say ghost bin?
What you mean ?
Yeah, but I see it always available, in BHS at least.
i use this http://kimsufi.cf/ and thanks i got one KS-1 few days ago
KS2 KS2SSD always available but KS-3 KS-4 KS-5 KS-6 not available