View on GitHub

Http client C++

Http Client is a library in C++ for making Http-requests

Download this project as a .zip file Download this project as a tar.gz file

HTTP-CLIENT

HTTP-CLIENT is an implementation of an HTTP client in c++ WIN32 and UNIX.

It has no dependencies.

Installation

Include CoucheHttp.h in your project , by loading it as usual:

#include "CoucheHttp.h"

If you 're compiling on Windows, linked libws2_32.a .

Basic Usage

    Header head;
    head.setHost("http://twitter.github.io");

    Http http(head);

    std::string page = http.getPage(&head);
    std::cout<<page<<std::endl;

Advanced Usage

    Header head;
    head.setHost("http://**.fr");
    head.setPath("/page/commit.php");

    head.setMethod("POST");

    head.setAccept("text/html,application/xhtml+xml,application/xml;q=0.9,*//*;q=0.8");
    head.setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0");
    head.setAccept_language("fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3");

    //head.setAccept_encoding("gzip, deflate");
    head.setConnexion("keep-alive");

    head.addCookie("__utmc","563565481430");

    head.addVariable("pseudo","MonPseudo");
    head.addVariable("motDePass","azery");


    Http http(head);

    std::string page = http.getPage(&head);

    std::cout<<page<<std::endl;

    //falcutatif
    head.removeVariable();
    head.removeCookie();

Authors and Contributors

In 2014 Lucas Bertola (@lucasBertola)

Support or Contact

Having trouble with Pages? Check out the documentation at https://github.com/lucasBertola/HTTP-CLIENT