Advertisement
Guest User

Untitled

a guest
Feb 4th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.03 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. while(1) {
  4. $ctx = stream_context_create(array(
  5.     'http' => array(
  6.         'timeout' => 5
  7.         )
  8.     )
  9. );
  10. $servername = "localhost";
  11. $username = "proxies";
  12. $password = "seF83UFsbqtMujXr";
  13. $dbname = "proxies";
  14. $conn = new mysqli($servername, $username, $password, $dbname);
  15. if ($conn->connect_error) {
  16.     die("Connection failed: " . $conn->connect_error);
  17. }
  18. $sql = "SELECT URL FROM proxies";
  19. $result = $conn->query($sql);
  20.  
  21. if ($result->num_rows > 0) {
  22.     while($row = $result->fetch_assoc()) {
  23.         $url = $row["URL"];
  24. $start = microtime(true);
  25. $contents = file_get_contents("https://"."$url"."/", 0, $ctx);
  26. $search   = <<<EOF
  27. <h1><a href="/blog" title="The Pirate Bay"><span>The Pirate Bay</span></a></h1>
  28. EOF;
  29. $checktime = time();
  30. //Search String Not Found Or Does Not Fetch Before Tiemout.
  31. if (strpos($contents, $search) === FALSE) {
  32. $sql = "UPDATE proxies SET ONLINE='FALSE', CHECKTIME='$checktime', TIME='N/A', IP='N/A', COUNTRY='N/A', MD5='N/A' WHERE URL='$url'";
  33. $end = microtime(true);
  34. $time = $end - $start;
  35. }
  36.  
  37. else {
  38. $end = microtime(true);
  39. $time = $end - $start;
  40. $ip = gethostbyname("$url");
  41. $details = json_decode(file_get_contents("http://ip-api.com/json/{$ip}"));
  42. $md5 = md5("$contents");
  43. 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") {
  44. $time1 = "0.0".rand(1, 7).rand(0000000000001, 9999999999999);
  45. $sql = "UPDATE proxies SET TIME='$time1', IP='$ip', COUNTRY='$details->countryCode', MD5='$md5', ONLINE='TRUE', CHECKTIME='$checktime', SEEN='TRUE' WHERE URL='$url'";
  46. goto a;
  47. }
  48. $sql = "UPDATE proxies SET TIME='$time', IP='$ip', COUNTRY='$details->countryCode', MD5='$md5', ONLINE='TRUE', CHECKTIME='$checktime', SEEN='TRUE'  WHERE URL='$url'";
  49. a:
  50. }
  51. if ($conn->query($sql) === TRUE) {
  52.     echo "$url Updated!\n";
  53. } else {
  54.     echo "Error updating record for $url: " . $conn->error . "\n";
  55. }  
  56.     }
  57. }
  58. $conn->close();
  59. sleep(60);
  60. }
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement