Previous Topic

Next Topic

Book Contents

Book Index

FTP - Specific Clients - cURL

cURL is a one-shot command-line file transfer utility. It is free for any use and may be downloaded here.

cURL may not be the easiest or prettiest client to use, but it is still a valuable utility because it runs on far more operating systems than any other secure file transfer client ever created (see cURL Operating Systems below).

MOVEit DMZ supports FTP/SSL and HTTPS uploads and downloads using cURL. cURL only supports explicit FTP over SSL at this time, so transfers will usually be initiated over port 21 and will be subject to the same firewall rules that other FTP/SSL transfers must adhere to.

FTP/SSL Downloads

Files may be downloaded directly from MOVEit DMZ (any version) with cURL if the full path to a particular file is known. The following example signs on to i.stdnet.com as ftpboi with password a1s2d3 and downloads a file called zerb.gif from the /Home/ftpboi folder.

curl -v -1 -o 
    "zerb.gif" --ftp-ssl --ftp-pasv -u ftpboi:a1s2d3 -Q "+CWD /Home/ftpboi" 
    "ftp://i.stdnet.com/zerb.gif"

Note the unusual path syntax. cURL cannot figure out FTP folder paths on its own so you must explicitly set the full path with the -Q argument. Also, the filename you wish to download must be in two places: the name of the output file (after the -o) and in the URL (at the end).

FTP/SSL Uploads

Files may be uploaded directly to MOVEit DMZ (any version) with cURL if the full path of the folder where a file is to uploaded is known. The following example signs on to i.stdnet.com as ftpboi with password a1s2d3 and uploads a file called sdn.gif into the /Home/ftpboi folder.

curl -v -1 -T "sdn.gif" --ftp-ssl --ftp-pasv 
    -u ftpboi:a1s2d3 -Q "+CWD /Home/ftpboi" 
    "ftp://i.stdnet.com"

Note the unusual path syntax. cURL cannot figure out FTP folder paths on its own so you must explicitly set the full path with the -Q argument.

HTTPS Downloads

Files may be downloaded directly from MOVEit DMZ (version 3.2+) with cURL if the file IDs are known. The following example signs on to i.stdnet.com as a user named httpboi with password a1s2d3 and downloads FileID #9102186 as dwn.gif. The second curl line will sign the related user off cleanly.

curl -k -1 -v -L -c cookie2.txt -o "dwn.gif" 
    "https://i.stdnet.com/human.aspx?Username=httpboi&Password=a1s2d3& 
    arg01=9102186&arg05=0/dwn.gif&arg12=downloaddirect&transaction=signon" 
curl -k -v -b cookie2.txt "https://i.stdnet.com/human.aspx?transaction=signoff"

The filename you wish to download must be in two places: the name of the output file (after the -o) and in the URL (after the arg05 tag). Otherwise, the syntax is similar to that used during "direct file downloads" initiated by MOVEit DMZ API applications running on web portals.

HTTPS Uploads

Files may be uploaded into MOVEit DMZ if the destination folder IDs are known. For example, the following three-call snippet will upload a file called hello1.gif of size (in bytes) 87054 into a MOVEit DMZ folder with ID 318060437 on i.stdnet.com as a user named httpboi with password a1s2d3. The first curl line signs the related user on to MOVEit DMZ. The second curl line actually performs the transfer (remember to keep these lines together so they aren't interpreted as separate commands). Also, "--data-ascii" should be used in place of "--data-binary" for ascii files. The third curl line will sign the related user off cleanly.

curl -k -v -c cookie2.txt "https://i.stdnet.com/human.aspx?transaction=signon&username=httpboi&password=a1s2d3" 
curl -b cookie2.txt -k -v --data-binary @hello1.gif     -H "Content-Type: multipart/form-data" 
    -H "X-siLock-AgentBrand: cURL" -H "X-siLock-AgentVersion: 4.32" 
    -H "X-siLock-FolderID: 318060437" -H "X-siLock-OriginalFilename: hello1.gif" 
    -H "X-siLock-FileSize: 87054" 
    "https://i.stdnet.com/moveitisapi/moveitisapi.dll?action=upload" 
curl -k -v -b cookie2.txt "https://i.stdnet.com/human.aspx?transaction=signoff"

cURL Operating Systems

As of March 4, 2005, the operating systems on which cURL was available as a native executable included: