如何从Linux命令行使用curl发送数据?
我正在尝试通过 wifi 连接从嵌入式 Linux 设备传输数据。我的设备上有curl 和wget。如何使用curl或wget将数据传输出设备?欢迎任何指点。
I am trying to transmit data out of an embedded Linux device over the wifi connection. I have curl and wget on the device. How would I transmit data out of the device using curl or wget ? Any pointers welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您只想发送(键,值)对,那么
但是如果您想发送一些文件,那么
If it is only (key,value) pairs that you want to send then
But if it is some file that you want to send then
wget 中有一个“--post-file”选项:
there is a "--post-file" option in wget:
这是一个获取:curl "http://www.google.com/?hl=en&q=search"
对于帖子,您必须使用选项“-d”并指定 key=value 变量
this is a get: curl "http://www.google.com/?hl=en&q=search"
for a post you have to use the option "-d" and specify the key=value variables
尝试使用 netcat,它是使用控制台发送接收数据的瑞士军刀;)。可以在此处找到一些涵盖常见用例的示例:
http://www.g- load.eu/2006/11/06/netcat-a- Couple-of-useful-examples/
发送文件:
在您的嵌入式设备上开始在端口 3333 上提供内容:
开你的电脑开始监听端口 3333 并将数据转储到文件中:
Try netcat, the swiss-army-knife for sending receiving data using the console ;). Some examples covering common use-cases can be found here:
http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/
Sending a file:
On your embedded device start serving content on port 3333:
On your PC start listening on port 3333 and dump data into a file: