How to send data using curl from Linux command line?

I am trying to transfer data from an embedded Linux device through a Wi-Fi connection. I have curl and wget on the device. How to transfer data from a device using curl or wget? Any pointers are welcome.

+8
linux bash curl wifi
source share
4 answers

wget has the option "-post-file":

wget --post-file=filetoSend URL 
+9
source share

If these are only the pairs (key, value) that you want to send,

 curl -d key1=value1 -d key2=value2 <URL> 

But if this is some kind of file that you want to send,

 curl --data-binary @<file path> <URL> 
+34
source share

this is get: curl "http://www.google.com/?hl=en&q=search"

for the message you need to use the option "-d" and specify the variables key = value

+1
source share

Try netcat, a Swiss knife to send the received 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/

File Submission:

On your embedded device, start serving content to port 3333:

 cat myfile.txt | nc -l 3333 

On a PC, start listening to port 3333 and upload the data to a file:

 nc <ip-of-embedded-device> 3333 > receivedData.txt 
0
source share

All Articles