cpprestsdk header

#include <cpprest/http_client.h>
#include <cpprest/filestream.h>

using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;

int main()
{
    // Step 1: Create an instance of http_client to represent the HTTP client.
    http_client client(U("http://www.example.com"));

    // Step 2: Create an HTTP request message.
    http_request request(methods::GET);

    // Step 3: Send the request and wait for a response.
    auto response = client.request(request).get();

    // Step 4: Check if the response status is OK (status code 200).
    if (response.status_code() == status_codes::OK)
    {
        // Step 5: Extract the response content as a string.
        auto body = response.extract_string().get();

        // Step 6: Print the response content.
        wcout << L"Response: " << body << endl;
    }
    else
    {
        // Step 7: Handle the case where the response status is not OK.
        wcerr << L"Error: " << response.status_code() << endl;
    }

    return 0;
}