#include <Windows.h>
#include <Wininet.h>
#include <iostream>
#include <fstream>
#pragma comment(lib, "WinInet.lib")
using namespace std;
 
int main()
{
 
HINTERNET connect = InternetOpenA("MyBrowser",INTERNET_OPEN_TYPE_PRECONFIG,NULL, NULL, 0);
 
   if(!connect){
      cout<<"Connection Failed or Syntax error";
      return 0;
   }
 
 

HINTERNET OpenAddress = InternetOpenUrlA(connect,"http://www.sebastian-weidemann.de/ip/iplog/read.php?data=SUPER_GEHEIMES_PASSWORT", NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE|INTERNET_FLAG_KEEP_CONNECTION, 0);
 
   if ( !OpenAddress )
   {
      DWORD ErrorNum = GetLastError();
      cout<<"Failed to open URL \nError No: "<<ErrorNum;
      InternetCloseHandle(connect);
      return 0;
   }
 
   char DataReceived[4096];
   DWORD NumberOfBytesRead = 0;
 
 
   while(InternetReadFile(OpenAddress, DataReceived, 4096, &NumberOfBytesRead) && NumberOfBytesRead )
   {
           DataReceived[NumberOfBytesRead]='\x00';
           cout << DataReceived;
   }
 
   ofstream datei;
   datei.open("datei.txt");
   datei << DataReceived;
 
system("PAUSE");
}