wfc_get_web_page

$Revision: 25 $

Declaration

void wfc_get_web_page( CUniformResourceLocator& url, CStringArray& page_contents, DWORD options )
void wfc_get_web_page( CUniformResourceLocator& url, CByteArray& page_contents, DWORD options )

Description

This function takes a url and retrieves it from Internet. What you get is an array of CStrings containing the source for that page. This function is meant to provide the capability to pull data from Internet and chew on it inside a program (as opposed to display it to a user).

The default options are:
INTERNET_FLAG_RELOAD Microsoft (Internet Explorer) tries to "help" you by caching web pages that you have visited. This flag tell Microsoft to stop helping and just go to the website and retrieve the page.
INTERNET_FLAG_TRANSFER_ASCII Can't remember why I have this flag or if it is even needed.
INTERNET_FLAG_NO_CACHE_WRITE Tells Microsoft (Internet Explorer) to stop "helping" me by writing the retrieved web page to a cache. This flags prevents the web page from being written to the browser cache.
INTERNET_FLAG_IGNORE_CERT_CN_INVALID Ignores invalid certificates when retrieving a secure web page.
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID Ignores invalid certificates when retrieving a secure web page.

Example

void print_maryland_weather_report( void )
{
   WFCTRACEINIT( TEXT( "print_maryland_weather_report()" ) );

   CUniformResourceLocator url( TEXT( "http://iwin.nws.noaa.gov/iwin/md/hourly.html" ) );

   CStringArray weather_report;

   wfc_get_web_page( url, weather_report );

   int index = 0;
   int number_of_lines_in_report = weather_report.GetSize();

   while( index < number_of_lines_in_report )
   {
      _tprintf( TEXT( "%s\n" ), (LPCTSTR) weather_report.GetAt( index ) );
      index++;
   }
}

Copyright, 1995-2002, Samuel R. Blackburn
$Workfile: wfc_get_web_page.cpp $
$Modtime: 9/06/01 2:49p $