Reputation: 3006
How can I port this wget stuff to scala:
wget --keep-session-cookies --save-cookies cookies.txt --post-data 'password=xxxx&username=zzzzz' http://server.com/login.jsp
wget --load-cookies cookies.txt http://server.com/download.something
I want to write a tiny, portable script, no external libraries etc.
Can that be done easily ?
Upvotes: 2
Views: 1091
Reputation: 2832
Your two main requirements appear to be:
Since Scala itself doesn't have much support for HTTP in the core library besides scala.io.Source, you're pretty much stuck with HttpUrlConnection from the Java itself. Looks like this site already has some examples of using HttpUrlConnection in ways like this: Reusing HttpURLConnection so as to keep session alive
Upvotes: 2