It's my 1st question here, so be gentle ;-)
I search how write a shell who can download a file from dropfile.to with curl
Context: We exchange videos we took with our GoPro with dropfile.to instead of cut them and send them by mail.
We don't need any registration but this website keep the videos during 24 hours before delete them automatically.
So, I write a shell who read my mail (done) and download automatically a video when it find a dropfile.to link...
For now, I know when I press the button "dowload file" on dropfile.to/$code, I send a POST request with the parameter dl_file_name : "$code"; the website do a redirection and do a GET request; the file I want is in the header answer as a file attachment...
so the curl request should be something like:
curl -L -O -J -d download-file:$code https://dropfile.to/$code
with options:
-L for the redirection
-O for download the result
-J for download the attachment file
-d for the POST method
Sadly, it not work... T_T
and when i use directly the get URL i found in my browser like:
curl -O -J $urlGet
i have some erors like:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 337 0 --:--:-- --:--:-- --:--:-- 337
100 154 100 154 0 0 139 0 0:00:01 0:00:01 --:--:-- 3080
Warning: Remote filename has no length!
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (23) Failed writing body (0 != 3445)
I hope you can help me
In application/x-www-form-urlencoded format, names and values are separated with equal symbol (=) :
code="p42zvEV"
curl -L -J -O "https://dropfile.to/$code" -d "dl_file_name=$code"
Related
I have a raspberry pi taking pictures, that is connected to the LAN. I want to automatically upload each picture file to a samba ubuntu file server I have on my network, so I can easily view them.
I have tried to get the command "curl" with no luck. (which I would run with subprocess in python)
This is my command that doesn't work (trying to copy test.png to destination directory):
curl -T "/home/pi/Desktop/test.png" "smb://10.51.112.128/home/thomas/thomasdrive/destination" -u thomas:87651234
I get:
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Couldn't connect to server
I've been searching the internet for a solution, but nothing I try seems to work
I am setting up cPanel on CentOS but have been facing this problem with connection. Its giving an error of "Connection refused".
I am working on a system with proxy internet.
curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:41 --:--:-- 0
curl: (7) Failed connect to securedownloads.cpanel.net:443; Connection refused
Update:
I have changed my VM adapter setting to "Bridged" from "NAT"
Still facing the error.
curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:03:33 --:--:-- 0
curl: (7) Failed connect to securedownloads.cpanel.net:443; Operation now in progress
Check if you have any firewall on your server which is blocking connections. Do a ping to securedownloads.cpanel.net.
ping securedownloads.cpanel.net
If ping is working and still your are getting this error.You can use wget as well.
wget https://securedownloads.cpanel.net/latest && sh latest
If you do not have wget. Install it.
yum install wget -y
I've installed couchdb and mingw64 on my windows 10, I can use futon to operate my couch db, no problem. Then I tried command line using curl.
I used curl to create database named "my_database", I can query it using "GET":
$ curl -X GET http://localhost:5984/my_database/002
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 81 100 81 0 0 397 0 --:--:-- --:--:-- --:--:-- 397{"_id":"002","_rev":"1-5e653801ca3cefde8abb6492ae3bcbcd","name":"mesi","age":23}
But I cannot do any data update, seems my curl syntax had problem:
$ curl -X PUT http://127.0.0.1:5984/my_database/002/msg.jpg?res=1-5e653801ca3cefde8abb6492ae3bcbcd --data-binary #/e/msg.jpg -H "ContentType:image/jpg"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
14 910k 100 58 14 128k 58 128k 0:00:07 --:--:-- 0:00:07 125M{"error":"conflict","reason":"Document update conflict."}
I know the jpg file is there:
$ ls /e/msg.jpg
/e/msg.jpg
Why I cannot update the jpg document as attachement? I guess I might have some syntax error using curl or couchdb, but how to fix it?
Using futon_db: created document, but what's the URL resource name of it?
Whenever you update a document/Attachment in CouchDB, you need to specify the revision (otherwise it cause conflicts). I guess that you only forgot to write rev properly (you wrote res).
Syntax taken from this question :
curl -vX PUT http://localhost:5984/YOUR_DB/YOUR_DOCUMENT/YOUR_ATTACHMENT.jpg?rev=REVISION_OF_THE_DOCUMENT_BEFORE_UPLOADING_AN_ATTACHMENT --data-binary #FILE_ON_THE_DISK.JPG -H "Content-Type: image/jpg"
Please help me to clear this error
Apples-Mac-mini:bin apple$ curl -L http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 193 100 193 0 0 244 0 --:--:-- --:--:-- --:--:-- 471
100 6711 100 6711 0 0 431 0 0:00:15 0:00:15 --:--:-- 5456
sh: line 20: npm-install-3294.sh: Permission denied
sh: npm-install-3294.sh: No such file or directory
rm: npm-install-3294.sh: No such file or directory
curl -L http://npmjs.org/install.sh | sudo sh
Note the sudo in front. The errors you get are due to installer trying to copy files to system folders, requiring administrative permissions.
Also, you do not actually need to install NPM, as it is included in latest Node.js versions.
To install Node.js on MacOS, refer to their official site.
To fix it, run sh using sudo:
$ curl http://npmjs.org/install.sh | sudo sh
When I use cURL, I Found it seems that cURL knew whether its own output will be redirect, or be input for another program.
Following are two different command:
curl http://www.google.com/
The output will be:
<HTML><HEAD>......blah, blah......</HEAD></HTML>
But if I use redirect or pipe, cURL will print its download status.
curl http://www.google.com/ | xargs echo
the output will be leading with:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 376 100 376 0 0 2729 0 --:--:-- --:--:-- --:--:-- 5295
<HTML><HEAD>......blah, blah......</HEAD></HTML>
My question is: how cURL know whether its print will be redirect?
isatty(3) will tell you if a FD is connected to a TTY.