https://github.com/kid0h/kidcurl
A Curl wrapper for kids!
https://github.com/kid0h/kidcurl
cpp libcurl wrapper
Last synced: 2 months ago
JSON representation
A Curl wrapper for kids!
- Host: GitHub
- URL: https://github.com/kid0h/kidcurl
- Owner: Kid0h
- License: gpl-3.0
- Created: 2021-06-28T21:43:09.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-16T02:25:29.000Z (almost 4 years ago)
- Last Synced: 2025-04-19T10:26:19.361Z (about 1 year ago)
- Topics: cpp, libcurl, wrapper
- Language: C++
- Homepage:
- Size: 5.07 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kidCurl: A Curl wrapper for kids!
A libcurl wrapper for simplified requests with a C++-style interface.
## Disclaimer
The kidCurl wrapper is not meant for production, it is simply an example of how one could use libcurl.
## Usage
You'll need libcurl already set up in your project in order to use this wrapper.
To start using the wrapper, include the `include` folder and you can start using `kidCurl.hpp`.
## Example
GET Request:
```c++
#include
#include
#define URL "https://www.myexternalip.com/raw"
int main(void) {
// Our request handler, we will use it to send our requests.
kidCurl reqHandler;
// Perform request
auto req = reqHandler.Send(kidCurl::Type::GET, URL);
if (req) {
// Request's HTTP Status code.
std::cout << "Status code: " << req->status_code << std::endl;
// Request's body.
std::cout << "\nBody: " << req->body << std::endl;
// Request's total time in milliseconds, divided by 1000 to get the value in seconds.
std::cout << "\nTotal time: " << (float)req->total_time / 1000 << std::endl;
// Print each header's name and it's value
std::cout << "\nHeaders: \n";
for (auto& header : req->headers)
std::cout << header.name << ": " << header.value << "\n";
}
// Wait for input
std::cin.get();
return 0;
}
```
For more examples click [here](examples/)!
## Reaching out
If you have any issues or questions - you can open an issue [here](https://github.com/Kid0h/kidCurl/issues/new)!