php - 使用范围通过 curl 在多个文件上指定输出名称

标签 php linux curl ssh

我正在尝试下载数百个 URL 并为每个指定输出名称,唯一的区别是 URL 中的 ID,例如 ..something/1/something.., ..something/3/something.., ..something/4/something..

我可以使用 -o filename.zip 但它会覆盖每个文件范围,我目前正在使用:

curl -o file.zip http://example.com/something/[1-500]/something/example/foo/bar/comma/zip

我怎样才能这样输出:?

file1.zip、file3.zip、file4.zip、..等

最佳答案

shell 中的一个简单循环就可以解决问题,例如:

#!/bin/bash
for i in `seq 1 500`; do
    curl -o file$i.zip http://example.com/something/$i/something/example/foo/bar/comma/zip
done

关于php - 使用范围通过 curl 在多个文件上指定输出名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33217671/

相关文章:

php - 需要有关 SQL QUERY 的帮助。使用外部联接或联合合并项目

php - 数组的数据多于应有的数据

linux - Apache 日志 grep、awk 或 sed

linux - 即使使用 -k 选项,'nc' 命令也会停止

Python 子进程调用在写入文件时抛出错误

php - 如何使用 cUrl、ssl 创建目录?

curl - Nginx 不会为 "if-modified-since" header 返回 304

php - 如何保护网页字体?

php - Composer autoload_namespaces 数组是空的,但它正在下载我的包

r - 在R上安装curl和readr