• Post Reply Bookmark Topic Watch Topic
  • New Topic

downloading a file from the internet  RSS feed

 
Snigdha Solanki
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to download a word document from an https site. Currently, I am doing it manually and the steps involved are:
1.Connect to the site
2.Login using user name and password
3.This opens a web page wherein it asks for a few details like date etc
4.After entering data I click on the download button to get the document

Is there a way to do all that programmatically?

thanks in advance,
Snigdha
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A search of this forum for "https" gets over a hundred hits, many with code snippets.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The short & sweet ...

Create a URL object
Hook an InputStream of some kind using the URL's openStream()
Open a FileOutputStream
Read ints from InputStream
Write ints to file
When the int you read is -1 you're done

To do HTTPS I added this before I opened the URL

Idonno if that's the best way, but it seemed to work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!