forked from libcpr/cpr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
28 lines (22 loc) · 795 Bytes
/
Copy pathexample.cpp
File metadata and controls
28 lines (22 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <fstream>
#include <sstream>
#include <cpr/cpr.h>
int main(int argc, char** argv) {
//std::cout << argv[1] << std::endl;
//std::ifstream inFile;
//inFile.open(argv[1]);
//std::stringstream strStream;
//strStream << inFile.rdbuf();
//std::string str = strStream.str(); //str holds the content of the file
//std::cout << str << "\n";
cpr::Response r = cpr::Get(cpr::Url{"127.0.0.1:8080"},
//cpr::Response r = cpr::Get(cpr::Url{str},
cpr::Authentication{"user", "pass", cpr::AuthMode::BASIC},
cpr::Parameters{{"anon", "true"}, {"key", "value"}});
r.status_code;
r.header["content-type"];
r.text;
//inFile.close();
return 0;
}