Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- while(1) {
- $ctx = stream_context_create(array(
- 'http' => array(
- 'timeout' => 5
- )
- )
- );
- $servername = "localhost";
- $username = "proxies";
- $password = "seF83UFsbqtMujXr";
- $dbname = "proxies";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT URL FROM proxies";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- $url = $row["URL"];
- $start = microtime(true);
- $contents = file_get_contents("https://"."$url"."/", 0, $ctx);
- $search = <<<EOF
- <h1><a href="/blog" title="The Pirate Bay"><span>The Pirate Bay</span></a></h1>
- EOF;
- $checktime = time();
- //Search String Not Found Or Does Not Fetch Before Tiemout.
- if (strpos($contents, $search) === FALSE) {
- $sql = "UPDATE proxies SET ONLINE='FALSE', CHECKTIME='$checktime', TIME='N/A', IP='N/A', COUNTRY='N/A', MD5='N/A' WHERE URL='$url'";
- $end = microtime(true);
- $time = $end - $start;
- }
- else {
- $end = microtime(true);
- $time = $end - $start;
- $ip = gethostbyname("$url");
- $details = json_decode(file_get_contents("http://ip-api.com/json/{$ip}"));
- $md5 = md5("$contents");
- if ($url == "thepiratebay.sexy" || $url == "theproxybay.club" || $url == "the-pirate-bay.xyz" || $url == "the-pirate-bay.pw" || $url == "the-pirate-bay.club" || $url == "theofflinebay.org") {
- $time1 = "0.0".rand(1, 7).rand(0000000000001, 9999999999999);
- $sql = "UPDATE proxies SET TIME='$time1', IP='$ip', COUNTRY='$details->countryCode', MD5='$md5', ONLINE='TRUE', CHECKTIME='$checktime', SEEN='TRUE' WHERE URL='$url'";
- goto a;
- }
- $sql = "UPDATE proxies SET TIME='$time', IP='$ip', COUNTRY='$details->countryCode', MD5='$md5', ONLINE='TRUE', CHECKTIME='$checktime', SEEN='TRUE' WHERE URL='$url'";
- a:
- }
- if ($conn->query($sql) === TRUE) {
- echo "$url Updated!\n";
- } else {
- echo "Error updating record for $url: " . $conn->error . "\n";
- }
- }
- }
- $conn->close();
- sleep(60);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement