cURL HTTP传输数据 [英] cURL HTTP transfer data

查看:361
本文介绍了cURL HTTP传输数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图第一次使用cURL下载一些数据。
我正在使用Windows 7中的cmd提示符。
我有一个txt文件,有很多URL,其中我想下载的文件。
在我用来检索我想要的数据的网站中,帮助说使用此功能下载数据集:

I am trying to use cURL for the first time to download some data. I am working with the cmd prompt in Windows 7. I have a txt file with lots of URLs where the files I want to download shoul be. In the website I am using to retrieve the data I want, the help says to use this function to download the dataset:

for i in `cat <url text file>`; do curl $i -OL -s; done

但在一些尝试后,我不能想出一个解决方案。
我应该插入什么,而不是?我想简单地指向存储txt文件的目录,并指定其名称和扩展名,如下所示:

but after some tries I culdn't come up with a solution so far. What am I supposed to insert instead of that ""? I thought simply to point to the directory where the txt file is stored and specify its name and extension, like this:

C:\Users\Umberto>for i in `cat C:\Users\Umberto\Downloads\data_url_script_2013-03-01_062649.txt`; do curl $i -OL -s; done

我收到消息

i non atteso

b $ b你有任何线索如何解决这个问题吗?
提前非常感谢。

(which means "i not expected") Do You have any clue how to solve this? Many thanks in advance.

一个最新的注释:
我成功地在当前目录下载文件,但只指定一个URL而不是我的名单。我现在感兴趣的是下载所有的数据(在文本文件中的URL列表中指定)通过一个单一的命令(如上面指定的一个)。

One up to date note: I succeded in downloading the file in the current directory, but only specifying one URL instead of the list I had. What I am interested to do now is download all the data I have (specified in a list of URLs within the text file) by one single command (as the one specified above).

推荐答案

看起来你正试图在Windows 7命令提示符下运行某种Unix风格的shell命令。

It looks like you are attempting to run some sort of Unix style shell command in the windows 7 command prompt.

如果在Windows PowerShell命令提示符中运行类似的命令,您应该能够实现相同的结果。
如果将curl工具解压缩到以下文件夹:C:\Users\Umberto\Curl,如果在Windows Powershell命令提示符下运行,以下内容应该可以工作。

You should be able to achieve the same result if you run a similar command in a Windows Powershell command prompt. If you unzip the curl tool to the following folder: C:\Users\Umberto\Curl the following should work if you run it in a Windows Powershell command prompt.

 Get-Content C:\Users\Umberto\Downloads\data_url_script_2013-03-01_062649.txt | %{C:\Users\Umberto\Curl\curl.exe $_ -OL -s}

这篇关于cURL HTTP传输数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆