Advertisement
Guest User

Untitled

a guest
Jan 26th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <?php
  2. $start1 = microtime(true);
  3. error_reporting(0);
  4. $servername = "localhost";
  5. $username = "proxies";
  6. $password = "seF83UFsbqtMujXr";
  7. $dbname = "proxies";
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. if ($conn->connect_error) {
  10. die("Connection failed: " . $conn->connect_error);
  11. }
  12. $string = file_get_contents('unsorted.txt');
  13. preg_match_all('/[a-z]+:\/\/\S+/', $string, $matches);
  14. foreach(array_unique($matches[0]) as $i => $url)
  15. {
  16. $url = parse_url($url)['host'];
  17. $start = microtime(true);
  18. $contents = file_get_contents("https://"."$url");
  19. $search = <<<EOF
  20. <meta name="google-site-verification" content="bERYeomIC5eBWlPLupPPYPYGA9GvAUKzFHh3WIw24Xs" />
  21. EOF;
  22. if (strpos($contents, $search) === FALSE) {
  23. $end = microtime(true);
  24. $time = $end - $start;
  25. } else {
  26. $end = microtime(true);
  27. $time = $end - $start;
  28. if ($url == "thepiratebay.se") {
  29. echo "$url Disallowed!\n";
  30. }else{
  31. if ($time > "5") {
  32. echo "$url Took Too Long To Load!\n";
  33. }else{
  34. $md5 = md5("$contents");
  35. $checktime = time();
  36. $ip = gethostbyname("$url");
  37. $details = json_decode(file_get_contents("http://ip-api.com/json/{$ip}"));
  38. $sql = "INSERT INTO proxies (URL, TIME, IP, COUNTRY, MD5, CHECKTIME)
  39. VALUES ('$url', '$time', '$ip', '$details->country', '$md5', '$checktime')";
  40. if ($conn->query($sql) === TRUE) {
  41. echo "$url Added!\n";
  42. } else {
  43. echo "Error: " . $sql . "<br>" . $conn->error;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. $conn->close();
  50. $end1 = microtime(true);
  51. $time1 = $end1 - $start1;
  52. echo "All Done! Seraching Compleated In $time1";
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement