Batch download sister image selfies

Source: Internet
Author: User
The source website has repeated images. After downloading the images, please unique them? Phpdefine (DocumentRoot, dirname (_ FILE _); histogram ($ durl, $ timeout5, $ referwww.baidu.com) {$ chcurl_init (); curl_setopt ($ ch, CURLOPT_URL, $ durl); curl_seto

The source website image already exists. After downloading the image, please re-= none? Phpdefine ('documentroot', dirname (_ FILE _); function curl_file_get_contents ($ durl, $ timeout = 5, $ refer = 'HTTP: // www.baidu.com ') {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ durl); curl_seto

The source website image already exists. After downloading the image, remove the duplicate = <无>
  window.setTimeout("window.location=\'' . $url . '\'", ' . $time . ');《script》';    exit();}function _mkdir($dir) {    if (file_exists($dir)) {        return true;    }    $u = umask(0);    $r = @mkdir($dir, 0777);    umask($u);    return $r;}function getHtml($url){    $page = curl_file_get_contents($url);    return $page;}function downloadImg($imgUrl,$foldername = 'img'){    $picpath = DocumentRoot.'/'.$foldername;    _mkdir($picpath);    $filename= basename($imgUrl);    $img = file_get_contents($imgUrl);    if ($img) {        file_put_contents($picpath.'/'.$filename, $img);        return true;    }    return false;}function findPage($html){    preg_match('/<\/a>/is', $html,$matches);    return $matches;}function findList($html){    preg_match_all('/

<\/p>/is', $html,$matches); return $matches;}$p = isset($_GET['p'])?max(1,$_GET['p']):1;$home = getHtml('http://www.mzitu.com/share/comment-page-'.$p);$list = findList($home);echo "now downloading page ".$p."...";if (is_array($list[1])) { foreach ($list[1] as $key => $value) { downloadImg($value); }}$page = findPage($home);if ($page[1] AND $page[1]>$p) { JsJump('/mzi.php?p='.$page[1]);}else{ exit("finished");}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.