Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL, "http://imgur.com/a/LKe3L");
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  5. $result = curl_exec($ch);
  6. $result = preg_replace("/[\n\r\t]/","",$result);
  7. preg_match_all("#//(i\.imgur\.com/[a-zA-Z0-9]+?\.jpg)#", $result, $tempMatch);
  8. foreach($tempMatch[1] as $val)
  9. {
  10. $url = "http://".$val;
  11. echo $url."\r\n";
  12. file_put_contents("./image/".preg_replace("@/@", "-",$val), file_get_contents($url));
  13. }
  14. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement