Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $pager = array(
- 'https://pictures.site.com/12321412421.jpg',
- 'https://pictures.site.com/vsdvxzvbcx.jpg',
- 'https://pictures.site.com/fbf547457.jpg',
- 'https://pictures.site.com/assfdsf76.jpg'
- )
- $multi = curl_multi_init();
- $channels = array();
- foreach ($pager as $url) {
- $ch = curl_init();
- $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';
- $destination = fopen(dirname(__FILE__).'/'.hash('sha256',rand()).'.jpg',"w+");
- curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_USERAGENT, $ua);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_REFERER, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
- curl_setopt($ch, CURLOPT_FILE, $destination);
- curl_multi_add_handle($multi, $ch);
- $channels[$url] = $ch;
- }
- $active = null;
- do {
- $mrc = curl_multi_exec($multi, $active);
- } while ($active > 0);
- while ($active && $mrc == CURLM_OK) {
- if (curl_multi_select($multi) == -1) {
- continue;
- }
- do {
- $mrc = curl_multi_exec($multi, $active);
- } while ($active > 0);
- }
- foreach ($channels as $channel) {
- curl_multi_remove_handle($multi, $channel);
- }
- curl_multi_close($multi);
Add Comment
Please, Sign In to add comment