MFC Proxy woes
-
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!
-
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!
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
-
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!
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: