Advertisement
Guest User

Untitled

a guest
Feb 15th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <?php
  2. require ('parse/phpQuery.php');
  3.  
  4. //Тред донор
  5. $thread = file_get_contents('https://2ch.hk/me/res/370128.html');
  6. $document = phpQuery::newDocument($thread);
  7.  
  8. $dir  = 'img/';
  9. $files = scandir($dir);
  10.  
  11. foreach ($files as $file):
  12.  
  13. $rand = rand(1, 394);
  14. $randimage  = rand(1, 577);
  15. $postMessage = $document->find('blockquote.post-message:eq('. $rand .')');
  16. $postMessage->find('a')->remove();
  17. $postMessage = trim(preg_replace('/\s{2,}/', ' ', $postMessage));
  18. echo $postMessage;
  19.  
  20.  
  21. $url = 'https://2ch.hk/makaba/posting.fcgi';
  22.  
  23. // Данные
  24. $postData['task'] = 'post';
  25. $postData['board'] = 'asylum';
  26. $postData['thread'] = '497842';
  27. $postData['comment'] = strip_tags($postMessage);
  28. $postData['image'] = '@img/'.$files[$randimage];
  29.  
  30. // инициализация cUrl
  31. $ch = curl_init();
  32.  
  33. // Куда отправим
  34. curl_setopt($ch, CURLOPT_URL, $url);
  35.  
  36. // Отправка
  37. curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
  38.  
  39. // Ответ сервера
  40. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  41.  
  42. // Отладка
  43. curl_setopt($ch, CURLOPT_VERBOSE, true);
  44.  
  45. // Отправка запроса
  46. $response = curl_exec($ch);
  47.  
  48. // Отладка
  49. echo $response;
  50.  
  51. // Таймаут для одного потока
  52.  
  53. sleep(20);
  54. endforeach;
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement