Skip to content

Instantly share code, notes, and snippets.

@SilentKernel
Created February 11, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SilentKernel/3c64a27d90ab325b148bd33f9d3c28d0 to your computer and use it in GitHub Desktop.
Save SilentKernel/3c64a27d90ab325b148bd33f9d3c28d0 to your computer and use it in GitHub Desktop.
<?php
// Sites
$sitesArray[] = "https://silentkernel.fr";
$sitesArray[] = "https://storage.silentkernel.fr";
// Users
$usersUrlArray[] = "https://smsapi.free-mobile.fr/sendmsg?user=xxxxxxx&pass=xxxxxxxxxx&msg=";
// Begin code
function getResponseInfo($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.23");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
return $info;
}
$resultString = "";
foreach ($sitesArray as $url) {
$info = getResponseInfo($url);
if (!isset($info["http_code"])) {
$resultString .= " " . $url;
} elseif ($info["http_code"] != 200) {
$resultString .= " " . $url;
}
// Prevent flooding servers
sleep(1);
}
if ($resultString != "") {
$SMS = urlencode("Down :" . $resultString);
// var_dump($SMS);
foreach ($usersUrlArray as $userUrl) {
getResponseInfo($userUrl . $SMS);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment