Skip to content

Instantly share code, notes, and snippets.

@igotit-anything
Last active March 20, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igotit-anything/efa7fa80b644ac4224b780075fde180a to your computer and use it in GitHub Desktop.
Save igotit-anything/efa7fa80b644ac4224b780075fde180a to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#pragma comment(lib, "cpprest141_2_10.LIB")
using namespace std;
using namespace utility; // Common utilities like string conversions
using namespace web; // Common features like URIs.
using namespace web::http; // Common HTTP functionality
using namespace web::http::client; // HTTP client features
using namespace concurrency::streams; // Asynchronous streams
void GetHttp()
{
http_client client(U("http://google.com"));
auto resp = client.request(U("GET")).get();
wcout << U("STATUS : ") << resp.status_code() << endl;
wcout << "content-type : " << resp.headers().content_type() << endl;
wcout << resp.extract_string(true).get() << endl;
}
int main()
{
GetHttp();
}
@igotit-anything
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment