• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

HTTPS File download

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic