| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
HTTP port 80
Hi All,
i want write data(when user open the browser i.e when he open "www.codeguru.com" and browse 5 minutes. what he browsed this duration i nedd write to file) to file, So how to i connect this port and get data from this port.?? and if he opend 2 URL i.e codeguru & google so how can i identify these url and write data to respective files? Thanks, Anand |
|
#2
|
|||
|
|||
|
Re: HTTP port 80
Hi Friends,
Using this code(WININIT) i am able to get the information for URL "http://www.codeguru.com/" i am using wininit. BOOL CInternetApp::InitInstance() { HINTERNET hINet, hFile; hINet = InternetOpen("InetURL/1.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 ); if ( !hINet ) { AfxMessageBox("InternetOpen Failed"); return 0; } hFile = InternetOpenUrl( hINet, "http://www.codeguru.com/", NULL, 0, INTERNET_FLAG_EXISTING_CONNECT, 0 ) ; if ( hFile ){ FILE *pFile; CHAR buffer[1024]; DWORD dwRead; pFile = fopen("C:\\HTTP.txt", "w"); while ( InternetReadFile( hFile, buffer, 500, &dwRead ) ) \{ if ( dwRead == 0 )break; buffer[dwRead] = 0; if( pFile == NULL) { MessageBox(NULL,"Unable write data to file ","HTTP ERROR",MB_TOPMOST); return -1; } fprintf(pFile, "%s", buffer); } fclose(pFile); } return FALSE; } Here i am lunching the URL through code and stored data in C:\HTTP.txt file(its come from HTTP port). But my requrment is when user open the browser and enter URL name say "www.codeguru.com" from onwards i want to write all data loaded on web page to HTTP.txt file till user close that URL.(if user moved one page to another web page we have to write that data to file). Is this way possible? any suggestion is heartly welcome. Thanks, Anand |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|