Re: [Web-ftp] Automating file transfers to WEBFTP
Status: Beta
Brought to you by:
aball
From: Dan N. <dn...@al...> - 2007-04-26 16:48:09
|
[cc'ing the list again since this might be useful to have in the archives] In the last episode (Apr 26), Mic...@ol... said: > This is the first time that I have been asked to do anything with file > transfers. I think they want us to use WEBFTP due to it being very > secure. Is there any documentation out there that can help me with the > way you proposed? If web-ftp is being used on an https:// url to secure a standard unencrypted FTP server, then you might not have direct access to the FTP server at all, and will have to go the scripting route. If it's just an http:// address, then it's no more secure than the FTP server itself, and you might as well ask for direct FTP access :) To script web-ftp access, what you'll have to do is mimic a form post (for the login step), capture an URL from the page that is returned, then upload/download using URLs constructed from that. Here's how to do it with curl. This simulates a login (replace myuser, mypass, and the URL with appropriate values), and puts the returned page in a file called "outfile": curl -L -o outfile -d username=myuser -d password=mypass http://localhost/web-ftp-2.2.1/web-ftp.cgi In outfile, you will need to extract the base of one of the URLs. There are a bunch of them, and they will all look like this: <FRAME NORESIZE NAME=HEAD SCROLLING="NO" SRC="http://localhost/web-ftp-2.2.0/web-ftpc.cgi/861961601511/HEAD"></FRAME> What you're interested in is the "http://localhost/web-ftp-2.2.0/web-ftpc.cgi/861961601511/" part. That's the URL for your logged in session. To upload a file named "myfile", append "POST" to your base url: curl -F uploaded_file=@myfile http://localhost/web-ftp-2.2.0/web-ftpc.cgi/861961601511/POST To download a file named "myfile", append "DNLD?myfile" to your base url. Note that you need to specify the filename in two places, one for web-ftp to know what to download, and the other to specify the local filename to create: curl -o myfile http://localhost/web-ftp-2.2.0/web-ftpc.cgi/861961601511/DNLD?myfile -- Dan Nelson dn...@al... |