HttpPing Sample: HTTP Client Tool
Demonstrates making HTTP Web requests from within a console application using ATL Server's HTTP client support.
The HttpPing sample allows HTTP requests to be launched from the command line, given a URL, and displays the server response headers and response time. The sample also supports optional settings such as proxy server and authorization settings, which can be provided either on the command line, or in an .ini file.
This sample demonstrates:
Directing HTTP transactions to use a proxy server using the CAtlHttpClientT::SetProxy function.
Launching HTTP client requests using the ATL Server CAtlHttpClientT class.
Retrieving the resulting HTTP response headers using the CAtlHttpClientT::GetRawResponseHeader function.
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.
Building and Running the Sample
To build and run this sample
Open the solution file, HttpPing.sln, in the Visual Studio development environment.
Build the solution.
Open a command prompt window from the Windows Start menu.
Change the current directory to where the HttpPing.exe file is located.
If your Internet connection requires the use of a proxy server, edit the HttpPing.ini file. Specify a proxy server name and port number, and set use_proxy to true.
Run the sample using this syntax:
HttpPing < URL >