stuppid_bot

Грабим картинки с мемами

Apr 26th, 2013
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2.  
  3. set_time_limit(0);
  4.  
  5. for ($i = 1; $i <= 22; ++$i) {
  6.     $html = file_get_contents("http://imgflip.com/memetemplates?page=$i");
  7.     preg_match_all("/img alt='(.+) Meme Template Thumbnail' src='([^']+)'/", $html, $matches);  
  8.     $c = count($matches[0]);
  9.    
  10.     for ($j = 0; $j < $c; ++$j) {
  11.         $name = strtolower( str_replace(' ', '-', $matches[1][$j]) );
  12.         $data = file_get_contents($matches[2][$j]);
  13.         file_put_contents("temp/$name.jpg", $data);
  14.     }
  15. }
  16.  
  17. echo('Закончили..');
  18.  
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment