Advertisement
Guest User

Linkedin Scrapper 2

a guest
Sep 11th, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.90 KB | None | 0 0
  1.   <?php
  2.  
  3. // uncompress file
  4. // sudo apt-get install p7zip-full
  5. // 7z x LinkedIn_Kk82Nh.7z
  6.  
  7. // no IP
  8. // sample entry
  9.  
  10. // 16143536 : 0932d7750ad638546788dbde939bb930e1934516 -> mindisgrishkus@yahoo.com
  11. // 1249646 : 54b1864b5d26d512783e7d0ec2243e66bca9575b -> wuli91@gmail.com
  12. // 1056010 : xxx -> dennis_wong2000@yahoo.com
  13.  
  14. // /Applications/MAMP/bin/php/php7.0.27/bin/php mysql.php
  15.  
  16. $basePath = dirname(getcwd());
  17. require_once $basePath . '/config.php';
  18.  
  19. // MySQL
  20. $mysqlCon = mysqli_connect($mysqlHost, $mysqlUsername, $mysqlPassword, $mysqlDBName);
  21. if (mysqli_connect_errno()){
  22.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  23. }
  24.  
  25. $leakSiteId = 24;
  26.  
  27. $file = getcwd() . "/29.txt";
  28. $content = file_get_contents($file);
  29. $rows = explode("\n", $content);
  30. // print_r($rows);
  31. foreach ($rows as $row) {
  32.   $row = str_replace(array("\n", "\r"), '', $row);
  33.   $row = explode(" -> ", $row);
  34.   // print_r($row);
  35.  
  36.   $email = isset($row[1]) ? trim(strtolower($row[1])) : null;
  37.  
  38.   if(!is_null($email) && filter_var($email, FILTER_VALIDATE_EMAIL)){
  39.     // print_r($row);
  40.  
  41.     echo "linkedin.com | $email\n";
  42.  
  43.     $sql = "SELECT id FROM email WHERE email = '" . mysqli_real_escape_string($mysqlCon, $email) . "'";
  44.     $result = mysqli_query($mysqlCon, $sql);
  45.     if(mysqli_num_rows($result) > 0){
  46.       while($row = mysqli_fetch_assoc($result)) {
  47.         $emailId = $row["id"];
  48.       }
  49.     }else{
  50.       $sql = "INSERT INTO email(email) VALUES ('" . mysqli_real_escape_string($mysqlCon, $email) . "')";
  51.       mysqli_query($mysqlCon, $sql);
  52.       $emailId = mysqli_insert_id($mysqlCon);
  53.     }
  54.  
  55.     $sql = 'INSERT INTO email_leak_site(email_id, leak_site_id)
  56.                    VALUES (?, ?)';
  57.     if($stmt = mysqli_prepare($mysqlCon, $sql)){
  58.       mysqli_stmt_bind_param($stmt, "ii", $emailId, $leakSiteId);
  59.       mysqli_stmt_execute($stmt);
  60.     }
  61.  
  62.   } // is email
  63. } // rows in textfiles
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement