referer = $parsedUrl['scheme'].$parsedUrl['host']; if($snoopy -> fetch($url)){ $content = $snoopy -> results; }else{ continue; } $newPath = $myRootPath.$imgSavedir."/"; if($delimDir != ''){ $newPath .= $delimDir."/"; if(!is_dir($newPath)){ mkdir($newPath, 0777); chmod($newPath, 0777); } } $file_ext = (strrchr($url, ".")) ? ".".strtolower(substr(strrchr(urldecode($url), "."),1)) : ''; if($reNameFile == ''){ $filenameOnly = strtolower(substr(strrchr(urldecode($url), "/"),1)); }else{ $filenameOnly = $reNameFile.$file_ext; } if($delEx != ''){ $filenameOnlyEx = explode($delEx, $filenameOnly); $filenameOnly = $filenameOnlyEx[0]; } $filename = $newPath.$filenameOnly; if(file_exists($filename)){ }else{ $newFile = fopen($filename,"wb"); fwrite($newFile,$content); fclose($newFile); } return $filenameOnly; } } ?>