https://github.com/scyth3-c/curl-http-wrapper
make http requests easily in c++ ⚡
https://github.com/scyth3-c/curl-http-wrapper
api-client cpp cpp20 http libcurl library linux makefile requests-module
Last synced: 3 months ago
JSON representation
make http requests easily in c++ ⚡
- Host: GitHub
- URL: https://github.com/scyth3-c/curl-http-wrapper
- Owner: scyth3-c
- License: gpl-3.0
- Created: 2022-06-18T22:40:09.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-02-25T03:18:06.000Z (over 1 year ago)
- Last Synced: 2025-04-05T22:05:31.857Z (3 months ago)
- Topics: api-client, cpp, cpp20, http, libcurl, library, linux, makefile, requests-module
- Language: C++
- Homepage:
- Size: 75.2 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README

# prepare, build and run
```
sudo make install
make
./bin/bin
```
## basic struct request
```c++
//#include "http/veridic"
Veridic Url("https://URL");
string data = Url.get();
cout << data;
```# curl-http-wrapper
make http requests easily in c++ using libcurl, contains two modules, raw http and Veridic that wraps the raw giving it even more functions, I recommend using Veridic but if you want you can use raw http but it has certain limitations, such as only making one request per instance which does not happen in Veridic
# modules
- **HTTP RAW (wrap curl)**
- **VERIDIC (wrap HTTP RAW)**# examples
_in main or function etc_
### POST```C++
Veridic tasty("https://API_name");
POST fields = {
"name: jhon",
"lastname: doe"
}
Headers headers = {
"data: test",
"example: true"
};
tasty.post(fields, headers, "/user");
tasty.post(fields, "/users");
tasy.post(fields);
```
### GET
## Methods
- POST
- GET
- PUT
- DELETE
- CUSTM### example get
### example put
### example delete
### example custom
## Project and Headers
the structure is very flexible in case you want to use directly the one I put, as long as you add the .cpp code inside the **src/sources** folder and add it in the **makefile** like this
```php
$(DIR_OBJ)/myFile.o
```
### FIELDS
the fields are a structure in charge of controlling and preparing the necessary parameters for the requests, they have no limit
Examples
```c++
in headers fields, DATA: VALUE
Headers = {
"data: 1",
"data: 2",
"data: N",
"N: N",
};
same that post >>>
in POST fields, DATa=value
POST fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
GET fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
PUT fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
DELETE fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
```### the fields
the fields are the same structure but with a typedef to make the code easier to read, the only difference is the field Headers, which has another structure
### other media
