I recently wrote a script to simulate some web transactions recently (not too different than yours), I had good luck following this tip from curl's website (hxxp://curl.haxx.se/docs/httpscripting.html):
Quote:
4.5 Figure Out What A POST Looks Like
When you're about fill in a form and send to a server by using curl instead
of a browser, you're of course very interested in sending a POST exactly the
way your browser does.
An easy way to get to see this, is to save the HTML page with the form on
your local disk, modify the 'method' to a GET, and press the submit button
(you could also change the action URL if you want to).
You will then clearly see the data get appended to the URL, separated with a
'?'-letter as GET forms are supposed to.
If there are 3 clicks, then there are going to be 3 separate curl commands. You should be able to avoid the first "click", because you'll just be uploading the file in step 2, no need to browse to the first page once you figure out the URL of your POST.
I'm making up examples in as I don't know what your actual HTML form looks like. The trick is figuring out the form query variables (order matters!!) and converting that into your curl command-line arguments.
Not sure if you can just supply the actual website... might be easier to give you the exact commands.
How can I get the upload and download speed of my pc, provided that my interface is wlan0?
I have though something like:
#!/bin/sh
ups=something
downs=somethingelse
echo "
Your current up speed is $ups
Your current down speed is $downs, but I have no idea how to get them?Are... (5 Replies)
Hi everyone!
I'm in a need of a shell script that search for all files in a folder, move all those files to a temp folder, and upload those files via FTP. When the file transfer via FTP completes successfully, the file is moved to a completed folder. In case any of those files fails, the file... (4 Replies)
Hi
I'm trying to download an xml file from a https server using curl on a Linux machine with Ubuntu 10.4.2
I am able to connect to the remote server with my username and password but the output is only "Virtual user <username> logged in".
I am expecting to download the xml file.
My output... (4 Replies)
Hello all,
I have been struggling with this issue on and off for a couple of weeks now and I just got it all working, so I wanted to share my findings in case some other poor soul needs to know how. First some background on what I'm doing. I am uploading files to different directories based on... (0 Replies)
Hi,
For an order I requested, the provider has uploaded a tar file in public FTP site which internally has tons of files (compressed) and I need to download files that follows particular pattern which would be few hundreds.
Note: The order can't be requested for files that follows the... (7 Replies)
Hi,
Im a newbie with programming and shell scripting. Im running OSX/Mac and Darwin.
I would like to create a shell script that would :
1. Search a Volume and directory (including subdirectories) for a file that :
* filename ends with ”_Highres.pdf” and
* the file creation date of... (8 Replies)
I am using the below curl command to download a single file from client server and it is working as expected
curl --ftp-ssl -k -u ${USER}:${PASSWD} ftp://${HOST}:${PORT}/path/to/${FILE} --output ${DEST}/${FILE}
let say the client has 3 files hellofile.101, hellofile.102, hellofile.103 and I... (3 Replies)
Hello,
My question is about curl command. (ubuntu14.04)
In terminal, I am able to download my mainfile with:
curl -u user1:pass1 http://11.22.33.44/*******
When I convert it into bash script like this:
#!/bin/bash
cd /root/scripts
computer_ip=11.22.33.44
curl -u $1:$2... (8 Replies)
Discussion started by: baris35
8 Replies
LEARN ABOUT MOJAVE
curlopt_upload
CURLOPT_UPLOAD(3) curl_easy_setopt options CURLOPT_UPLOAD(3)NAME
CURLOPT_UPLOAD - enable data upload
SYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD, long upload);
DESCRIPTION
The long parameter upload set to 1 tells the library to prepare for and perform an upload. The CURLOPT_READDATA(3) and CURLOPT_INFILE-
SIZE(3) or CURLOPT_INFILESIZE_LARGE(3) options are also interesting for uploads. If the protocol is HTTP, uploading means using the PUT
request unless you tell libcurl otherwise.
Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with CURLOPT_HTTPHEADER(3) as
usual.
If you use PUT to a HTTP 1.1 server, you can upload data without knowing the size before starting the transfer if you use chunked encoding.
You enable this by adding a header like "Transfer-Encoding: chunked" with CURLOPT_HTTPHEADER(3). With HTTP 1.0 or without chunked transfer,
you must specify the size.
DEFAULT
0, default is download
PROTOCOLS
Most
EXAMPLE
CURL *curl = curl_easy_init();
if(curl) {
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* enable uploading */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* specify target */
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
/* now specify which pointer to pass to our callback */
curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
/* Set the size of the file to upload */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
/* Now run off and do what you've been told! */
curl_easy_perform(curl);
}
AVAILABILITY
Always
RETURN VALUE
Returns CURLE_OK
SEE ALSO CURLOPT_PUT(3), CURLOPT_READFUNCTION(3), CURLOPT_INFILESIZE_LARGE(3),
libcurl 7.54.0 February 03, 2016 CURLOPT_UPLOAD(3)