The Micro C++ Library
samples/HTTPclient.cxx File Reference
#include <micxx.hxx>
#include <cstdlib>

Classes

class  MyHTTPReceiver

Functions

int main (int argc, const char *args[])

Function Documentation

int main ( int  argc,
const char *  args[] 
)
{
    try
    {
        micxx::System system(argc, args);

        //std::string url1     = micxx::System::getString(L"url1", true);
        //std::string url2     = micxx::System::getString(L"url2");
        std::string certURL  = micxx::System::getString(L"cert.url");
        std::string certPass = micxx::System::getString(L"cert.pass");
        std::string caStore  = micxx::System::getString(L"ca.store");

        micxx::URL url;
        url = "https://CXBGSP00:DBJH5836@webgate.deutsche-boerse.com/200.html";
        std::cout << "url                 : " << url      << std::endl;

        MyHTTPReceiver myReceiver;
        micxx::HTTPConnection http;
        http.setReceiver(&myReceiver);
        http.get("http://www.google.de");

        std::cout << "certificate URL     : " << certURL  << std::endl;
        std::cout << "certificate password: " << certPass << std::endl;
        std::cout << "CA certificates     : " << caStore  << std::endl;

        //micxx::SSLClientSocket sslClientSocket;
        //if (certURL.length())
        //{
        //    sslClientSocket.getSSLProtocol().setCertificates(certURL, &certPass);
        //}
        //if (caStore.length())
        //{
        //    sslClientSocket.getSSLProtocol().setCACertificates(caStore);
        //}
        //micxx::InetAddress inetAddress(url1);

        //sslClientSocket.connect(inetAddress);
        //std::string hello("GET /200.html HTTP/1.1\r\nHost: www.example.net\r\n\r\n");
        //sslClientSocket.send(hello.c_str(), hello.length());
        //while (true)
        //{
        //    std::string text = sslClientSocket.readLn();
        //    std::cout << text;
        //}
        //sslClientSocket.close();
    }
    catch (const std::exception & exception)
    {
        std::cerr << exception.what() << std::endl;
        return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
}