• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTPS File download

 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.

I need to download files through my program from an https site.
I've done this through ftp. But can't see how it's done through https.
Can it be done? How?

Thanks in advance.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this example. It creates a Reader from the InputStream -which wouldn't be appropriate for a binary file- but otherwise it's just what you're asking for.
 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf.

It's returning data. The only problem is it's not returning the correct data.
I think it has something to do with the encoding but i cant seem to fix the problem.
Here's the file I'm trying to get.

https://commerce.sars.gov.za/mas_static/code_tables/CARGOCARRIER.csv

any help appreciated.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There shouldn't be any encoding issues if you save the bytes you receive from the InputStream directly into a file. Encodings only enter the picture once the bytes are converted into characters.

Open the saved file in a text editor, and try out various encodings to see which one might be correct.
 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It comes up as "Unicode" in EmEditor. but when I try read it using "Unicode" in the program it still doesn't come out right.

I need to convert it to characters in order to work with it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic