Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to get a https file

How to get a https file

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialsysadminhelpquestion
4 Posts 4 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FerrariDMan
    wrote on last edited by
    #1

    Hi Can anybody help me? I have a https-file on a server in the internet and want to get the file. The adress look like: https://ss004.ak.se/http://ss005.ak...productLogo.gif This is not the right adress is only a example. I managed to get a CInternetSession pointer and with that I made a GetHttpConnection to get a pointer to CHttpConnection. With that pointer I know I need to make a OpenRequest() but from that point on I have no clue what to write next. What do I have to do for that??? Thanks D

    A A 2 Replies Last reply
    0
    • F FerrariDMan

      Hi Can anybody help me? I have a https-file on a server in the internet and want to get the file. The adress look like: https://ss004.ak.se/http://ss005.ak...productLogo.gif This is not the right adress is only a example. I managed to get a CInternetSession pointer and with that I made a GetHttpConnection to get a pointer to CHttpConnection. With that pointer I know I need to make a OpenRequest() but from that point on I have no clue what to write next. What do I have to do for that??? Thanks D

      A Offline
      A Offline
      Abhishek Srivastava
      wrote on last edited by
      #2

      Hi , i have also done the same thing once but using Wininet APIS i can guide u how to use them. To use the HTTP WinInet functions Call the InternetOpen function to initialize an Internet handle. InternetOpen creates the root HINTERNET handle used to establish the HTTP session. The HINTERNET is used by all subsequent functions. Call InternetConnect using the HINTERNET returned by InternetOpen to create an HTTP session. When calling InternetConnect, specify INTERNET_DEFAULT_HTTP for the nServerPort parameter and INTERNET_SERVICE_HTTP for the dwService parameter. InternetConnect uses the handle returned by InternetOpen to create a specific HTTP session. InternetConnect initializes an HTTP session for the specified site, using the arguments passed to it and creates HINTERNET that is a branch off the root handle. InternetConnect does not attempt to access or establish a connection to the specified site. Call HttpOpenRequest to open an HTTP request handle. HttpOpenRequest uses the handle created by InternetConnect to establish a connection to the specified site. Call HttpSendRequest using the handle created by the HttpOpenRequest to send an HTTP request to the HTTP server. Call InternetReadFile to download data. –Or– Call InternetQueryDataAvailable to query how much data is available to be read by a subsequent call to InternetReadFile. Call InternetCloseHandle to close the handle created by HttpOpenRequest. Call InternetCloseHandle to close the HTTP session created by InternetConnect. Call InternetCloseHandle to close the handle created by InternetOpen. in this way u can download ur file :) Abhishek Srivastava Software Engineer (VC++) India ,Noida Mobile no 9891492921 :)

      M 1 Reply Last reply
      0
      • F FerrariDMan

        Hi Can anybody help me? I have a https-file on a server in the internet and want to get the file. The adress look like: https://ss004.ak.se/http://ss005.ak...productLogo.gif This is not the right adress is only a example. I managed to get a CInternetSession pointer and with that I made a GetHttpConnection to get a pointer to CHttpConnection. With that pointer I know I need to make a OpenRequest() but from that point on I have no clue what to write next. What do I have to do for that??? Thanks D

        A Offline
        A Offline
        alex barylski
        wrote on last edited by
        #3

        You could maybe use URLDownloadToCacheFile. The word of the day is legs, let's go back to my house and spread the word ;P

        1 Reply Last reply
        0
        • A Abhishek Srivastava

          Hi , i have also done the same thing once but using Wininet APIS i can guide u how to use them. To use the HTTP WinInet functions Call the InternetOpen function to initialize an Internet handle. InternetOpen creates the root HINTERNET handle used to establish the HTTP session. The HINTERNET is used by all subsequent functions. Call InternetConnect using the HINTERNET returned by InternetOpen to create an HTTP session. When calling InternetConnect, specify INTERNET_DEFAULT_HTTP for the nServerPort parameter and INTERNET_SERVICE_HTTP for the dwService parameter. InternetConnect uses the handle returned by InternetOpen to create a specific HTTP session. InternetConnect initializes an HTTP session for the specified site, using the arguments passed to it and creates HINTERNET that is a branch off the root handle. InternetConnect does not attempt to access or establish a connection to the specified site. Call HttpOpenRequest to open an HTTP request handle. HttpOpenRequest uses the handle created by InternetConnect to establish a connection to the specified site. Call HttpSendRequest using the handle created by the HttpOpenRequest to send an HTTP request to the HTTP server. Call InternetReadFile to download data. –Or– Call InternetQueryDataAvailable to query how much data is available to be read by a subsequent call to InternetReadFile. Call InternetCloseHandle to close the handle created by HttpOpenRequest. Call InternetCloseHandle to close the HTTP session created by InternetConnect. Call InternetCloseHandle to close the handle created by InternetOpen. in this way u can download ur file :) Abhishek Srivastava Software Engineer (VC++) India ,Noida Mobile no 9891492921 :)

          M Offline
          M Offline
          Marcello
          wrote on last edited by
          #4

          I did that too but it works only with http files if I am not wrong. It doesn't work with https web pages ! The problem is how to handle the SSL. How can that be done in C++ ? Especially if it is a page that need a login Thank you very much for any answer ! Marcello

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups