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. Send request to open a http link

Send request to open a http link

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
6 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.
  • P Offline
    P Offline
    Pryabu
    wrote on last edited by
    #1

    Hi, I want to send a request to execute a http link which is running in another machine.how to do this using?Is there any function in MFC or SDK? anyone please help me? thanks,

    E C 2 Replies Last reply
    0
    • P Pryabu

      Hi, I want to send a request to execute a http link which is running in another machine.how to do this using?Is there any function in MFC or SDK? anyone please help me? thanks,

      E Offline
      E Offline
      eusto
      wrote on last edited by
      #2

      See CHttpConnection and the other classes that help you do this

      1 Reply Last reply
      0
      • P Pryabu

        Hi, I want to send a request to execute a http link which is running in another machine.how to do this using?Is there any function in MFC or SDK? anyone please help me? thanks,

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        What do you mean by "execute"?

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <

        P 1 Reply Last reply
        0
        • C Code o mat

          What do you mean by "execute"?

          > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <

          P Offline
          P Offline
          Pryabu
          wrote on last edited by
          #4

          I want to send a request to another system to run a URL.I tried with following code. Its showing error like URL is invalid. But im able to open that URL from my machine.But not able to open that URL using this code. CInternetSession objInetSession; CHttpConnection *objhttp ; CHttpFile *objFile; char szURL[100]; while(1) { objhttp = objInetSession.GetHttpConnection ("http:////101.16.0.42/test/prelogin.aspx", INTERNET_FLAG_MAKE_PERSISTENT, INTERNET_INVALID_PORT_NUMBER, NULL, NULL); try { wsprintf(szURL,"%s","http:////101.16.0.242/test/prelogin.aspx"); CStdioFile* objStdFile = objInetSession.OpenURL(szURL,1,INTERNET_FLAG_TRANSFER_ASCII,NULL,0); } catch(CInternetException* exp) { exp->ReportError(MB_OK,0); } }

          modified on Thursday, April 8, 2010 1:29 AM

          E 1 Reply Last reply
          0
          • P Pryabu

            I want to send a request to another system to run a URL.I tried with following code. Its showing error like URL is invalid. But im able to open that URL from my machine.But not able to open that URL using this code. CInternetSession objInetSession; CHttpConnection *objhttp ; CHttpFile *objFile; char szURL[100]; while(1) { objhttp = objInetSession.GetHttpConnection ("http:////101.16.0.42/test/prelogin.aspx", INTERNET_FLAG_MAKE_PERSISTENT, INTERNET_INVALID_PORT_NUMBER, NULL, NULL); try { wsprintf(szURL,"%s","http:////101.16.0.242/test/prelogin.aspx"); CStdioFile* objStdFile = objInetSession.OpenURL(szURL,1,INTERNET_FLAG_TRANSFER_ASCII,NULL,0); } catch(CInternetException* exp) { exp->ReportError(MB_OK,0); } }

            modified on Thursday, April 8, 2010 1:29 AM

            E Offline
            E Offline
            eusto
            wrote on last edited by
            #5

            1. '/' is not an escape character so your url should be "http://101.16.0.42/..." not http:////... 2. Depending on what that the script at that url does, what you're trying to do might or might not work. Read about the HTTP protocolhere in very simple terms, when using a http connection, you're making a request (that might contain some parameters - see GET/POST methods) and you receive a response - the html code that you see in your browser I hope this helps :)

            P 1 Reply Last reply
            0
            • E eusto

              1. '/' is not an escape character so your url should be "http://101.16.0.42/..." not http:////... 2. Depending on what that the script at that url does, what you're trying to do might or might not work. Read about the HTTP protocolhere in very simple terms, when using a http connection, you're making a request (that might contain some parameters - see GET/POST methods) and you receive a response - the html code that you see in your browser I hope this helps :)

              P Offline
              P Offline
              Pryabu
              wrote on last edited by
              #6

              thanks

              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