Guest User

Untitled

a guest
May 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. $pager = array(
  2. 'https://pictures.site.com/12321412421.jpg',
  3. 'https://pictures.site.com/vsdvxzvbcx.jpg',
  4. 'https://pictures.site.com/fbf547457.jpg',
  5. 'https://pictures.site.com/assfdsf76.jpg'
  6. )
  7. $multi = curl_multi_init();
  8. $channels = array();
  9.  
  10. foreach ($pager as $url) {
  11. $ch = curl_init();
  12. $ua = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13';
  13. $destination = fopen(dirname(__FILE__).'/'.hash('sha256',rand()).'.jpg',"w+");
  14. curl_setopt($ch, CURLOPT_HEADER, true);
  15. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  16. curl_setopt($ch, CURLOPT_USERAGENT, $ua);
  17. curl_setopt($ch, CURLOPT_URL, $url);
  18. curl_setopt($ch, CURLOPT_REFERER, $url);
  19. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  20. curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
  21. curl_setopt($ch, CURLOPT_FILE, $destination);
  22. curl_multi_add_handle($multi, $ch);
  23. $channels[$url] = $ch;
  24. }
  25. $active = null;
  26. do {
  27. $mrc = curl_multi_exec($multi, $active);
  28. } while ($active > 0);
  29.  
  30. while ($active && $mrc == CURLM_OK) {
  31. if (curl_multi_select($multi) == -1) {
  32. continue;
  33. }
  34.  
  35. do {
  36. $mrc = curl_multi_exec($multi, $active);
  37. } while ($active > 0);
  38. }
  39.  
  40. foreach ($channels as $channel) {
  41. curl_multi_remove_handle($multi, $channel);
  42. }
  43.  
  44. curl_multi_close($multi);
Add Comment
Please, Sign In to add comment