Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. ignore_user_abort(true);
  4. ini_set('display_errors', 'off');
  5. ini_set('error_log','error_log.txt');
  6. header('X-Robots-Tag: noindex');
  7.  
  8. // запускать в консоле:
  9. // wget -r -l 0 -U DorGen --spider --no-cache --no-parent --max-redirect=500 http://дорвей/cache.php
  10.  
  11. require_once('php/func.php');
  12.  
  13. $pagelist = $db->query("SELECT url, category FROM pages WHERE date < ".$time." AND pars = 0 LIMIT 5;");
  14.  
  15. $all_links = array();
  16. while ($echo = $pagelist->fetchArray()) {
  17. $all_links[] = $httpscheme.'://'.$host.'/'.$echo['category'].'/'.$echo['url'].'/';
  18. }
  19.  
  20. $links_count = count($all_links);
  21.  
  22. $curl_arr = array();
  23. $master = curl_multi_init();
  24.  
  25. for($i = 0; $i < $links_count; $i++) {
  26. $url = trim($all_links[$i]);
  27. $curl_arr[$i] = curl_init($url);
  28. curl_setopt($curl_arr[$i], CURLOPT_HEADER, false);
  29. curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true);
  30. curl_setopt($curl_arr[$i], CURLOPT_DNS_CACHE_TIMEOUT, 600);
  31. curl_setopt($curl_arr[$i], CURLOPT_TIMEOUT, 3);
  32. curl_setopt($curl_arr[$i], CURLOPT_CONNECTTIMEOUT, 2);
  33. curl_setopt($curl_arr[$i], CURLOPT_USERAGENT, 'Wmsn Doorway Generator');
  34. curl_setopt($curl_arr[$i], CURLOPT_SSL_VERIFYPEER, false);
  35. curl_setopt($curl_arr[$i], CURLOPT_SSL_VERIFYHOST, false);
  36. curl_setopt($curl_arr[$i], CURLOPT_ENCODING, 'gzip');
  37. curl_setopt($curl_arr[$i], CURLOPT_FTP_SSL, CURLFTPSSL_TRY);
  38. curl_multi_add_handle($master, $curl_arr[$i]);
  39. }
  40.  
  41. do {curl_multi_exec($master, $running);} while($running > 0);
  42.  
  43. $id = @trim(strip_tags($_GET['id']));
  44. if (!is_numeric($id)) {$id = 1;}
  45. $id = $id + 1;
  46. if ($links_count > 1) {
  47. echo '<a href="/cache.php?id='.$id.'">'.$id.'</a>';
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement