Home  >  Article  >  Backend Development  >  Download files in batches

Download files in batches

WBOY
WBOYOriginal
2016-07-28 08:26:351791browse

//File download
$host = $config['DB_HOST'];
$port = $config['DB_PORT'];
$user = $config['DB_USER'];
$pwd = $ config['DB_PWD'];
$conn = @ mysql_connect($host.":".$port, $user, $pwd) or die("{'status':0,'msg':'Database connection error' }");
if($dbc $conn)){
}else{
echo("Could not connect to mysql");
}
$sql = "SELECT link FROM `frame` where cid=1";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
$imagesURL = $row['link'];
file_put_contents(basename($imagesURL), file_get_contents($imagesURL));

$i++;

}

echo $i;
?>

The above has introduced the batch downloading of files, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn