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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Best way to open a HTML file from an URL

Best way to open a HTML file from an URL

Scheduled Pinned Locked Moved C / C++ / MFC
questionphphtmldatabasetutorial
3 Posts 3 Posters 0 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.
  • J Offline
    J Offline
    Joschwenk666
    wrote on last edited by
    #1

    Hallo, I try to open the html return from an Internet URL, for example http://leavemusic.de/live/leavemusic/index.php, and I want to get the html code in a CString. What is the best way to do it? It does not work with CFile for me. Thank you!

    D A 2 Replies Last reply
    0
    • J Joschwenk666

      Hallo, I try to open the html return from an Internet URL, for example http://leavemusic.de/live/leavemusic/index.php, and I want to get the html code in a CString. What is the best way to do it? It does not work with CFile for me. Thank you!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you tried URLDownloadToFile()?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      1 Reply Last reply
      0
      • J Joschwenk666

        Hallo, I try to open the html return from an Internet URL, for example http://leavemusic.de/live/leavemusic/index.php, and I want to get the html code in a CString. What is the best way to do it? It does not work with CFile for me. Thank you!

        A Offline
        A Offline
        Aescleal
        wrote on last edited by
        #3

        If you don't want to use the function David suggested and if you've got time to experiment I can wholeheartedly recommend using cURL[^] for what you're trying to do. It's very customisable, flexible and portable. It's also got a bit of a clunky C handle based interface only it's programmer could love but for the sort of thing you're after it's not too bad. It took me about 4 hours of reading and playing to get a small file downloader working with it. If you know how to use sockets then you could just open a socket on the remote computer, send and HTTP get and read everything between the opening <HEAD> tag and the closing </BODY> tag. I'd only recommend this method if you're already comfy with network programming otherwise the small details might get a bit much. Cheers, Ash

        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