This program is actually an important part of the "thief program". This section of the program is just the section for downloading remote images. The program is relatively simple to write, and most parts are commented.
if (preg_match_all("/http://[^ "']+[. jpg|.gif|.jpeg|.png]+/ui",stripcslashes($content),$aliurl)){
$i=0; //Multiple files++
while(list($ key ,$v) = each($aliurl[0])){
//echo $v."
";
$filetype = pathinfo($v, PATHINFO_EXTENSION); // Get the suffix name
$ff = @file_get_contents($v); //Get the binary file content
if(!stripos($v,"jb51.net")){//Determine whether it is your own website The picture below
if (!empty($ff)){ //Perform the following operations after obtaining the file
$dir = "upload/".date("Ymd")."/";// Specify a new storage path
if (!file_exists($dir)){//Determine whether the directory exists
@mkdir($dir,511,true); //Create a multi-level directory, 511 is converted into decimal 777 has executable permissions
}
$nfn = $dir.date("Ymdhis").$i.".".$filetype; //New name of build file
$nf = @fopen ($nfn,"w"); //Create file
fwrite($nf,$ff); //Write file
fclose($nf); //Close file
$i++; / /Multiple files++
echo "
";
$content = str_replace($v,$nfn, $content);//Replace content Parameters
}else{//If the image cannot be obtained, replace it with the default image
$content = str_replace($v,"/upload/201204/20120417213810742.gif", $content);//Replace content Parameters
}
}
}
}
PHP implementation code for downloading images to local through regular expressions