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. MFC Proxy woes

MFC Proxy woes

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

    Hi, I want to open a http connection, call an asp page, and read the response from that asp page. However, I need to go through a proxy to do this. Could someone show me actual code that would achieve this?? I have searched heaps and only found vague information on how to do it. 1. POST data to an asp page 2. receive the response from the asp page 3. must go through the proxy Please help!! Thanks!

    J E 2 Replies Last reply
    0
    • L Lost User

      Hi, I want to open a http connection, call an asp page, and read the response from that asp page. However, I need to go through a proxy to do this. Could someone show me actual code that would achieve this?? I have searched heaps and only found vague information on how to do it. 1. POST data to an asp page 2. receive the response from the asp page 3. must go through the proxy Please help!! Thanks!

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      Have a look at Chris Maunder's article A class to download files from the net. Seems to do all that you want. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      1 Reply Last reply
      0
      • L Lost User

        Hi, I want to open a http connection, call an asp page, and read the response from that asp page. However, I need to go through a proxy to do this. Could someone show me actual code that would achieve this?? I have searched heaps and only found vague information on how to do it. 1. POST data to an asp page 2. receive the response from the asp page 3. must go through the proxy Please help!! Thanks!

        E Offline
        E Offline
        eXplodus
        wrote on last edited by
        #3

        CHttpFile *s; CHttpConnection *c; CInternetSession *is; if (useProxy) is = new CInternetSession(NULL, 1, INTERNET_OPEN_TYPE_PROXY, ProxyURL); else is = new CInternetSession(NULL, 1, INTERNET_OPEN_TYPE_DIRECT); c = is->GetHttpConnection("ip", (INTERNET_PORT) 4000); wsprintf (param,"nickname=%s&password=%s&entranceRoom=%s",User,PassWd,RaumName); wsprintf (length,"Content-Length: %d\r\n",strlen(param)); strcpy (header,hdrs2); strcat (header,hdrs3); strcat (header,hdrs4); strcat (header,length); strcat (header,hdrs5); wsprintf(rline, "/Login.html"); s = c->OpenRequest("POST",rline,referer,0,NULL,"HTTP/1.1",INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD); LPCTSTR lpszHeaders = header; s->SendRequest(lpszHeaders, strlen(header), param, strlen(param)); f = new fstream("back.html", ios::out); while (s->ReadString(l) != FALSE) { ... // some *f things } delete f; s->Close(); delete s; delete c; delete is; this is only a little example from my code ... not even perfect but its working. u always have to check ur headers and the things that you send. best way to check is a html browser and a packet sniffer. there are many outta there. with the sniffer u see the original header and data. and could also check your program that it send also the right one. bye :suss:

        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