Another C++ problem!
Posted: Mon Jul 19, 2004 9:03 pm
Yes everyone it is another one of my C++ questions
I know this is not the place but the last time I asked for help on C++ here I got bundles of help from other members. Anyway, the problem is that I wish to send a GET request so the source of the selected page is shown to the screen, much like get() in perl. Everything works excellent but instead of displaying the source it shows either 1 or 0. Where 1 is true and 0 is false.
Can anyone recommend any techniques in C++ please to show the source to the console.
Regards
Joe
Code: Select all
#include <iostream.h>
#include <wininet.h>
#include <windows.h>
#define NET_ADDR "IP-WILL-GO-HERE"
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
{
HINTERNET hINEt,hConnection,hData;
hINEt = InternetOpen("InetURL/1.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (!hINEt) { cout<<"Internet open failed. Please try again!\n"; }
hConnection = InternetConnect(hINEt, NET_ADDR, 80, " "," ", INTERNET_SERVICE_HTTP, 0, 0);
if (!hConnection)
{
cout<<"Internet Connection error...\n";
InternetCloseHandle(hINEt);
}
hData = HttpOpenRequest(hConnection, "GET", "/Tutorials/section.php", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
cout<<HttpSendRequest( hData, NULL, 0, NULL, 0);
}Regards
Joe