I'm trying to learn C and get comfortable with it. How do I make HTTP requests?
What do I do to handle JSON?
For further actions, you may consider blocking this person and/or reporting abuse
I'm trying to learn C and get comfortable with it. How do I make HTTP requests?
What do I do to handle JSON?
For further actions, you may consider blocking this person and/or reporting abuse
Misael Amorim -
Paulo Mota -
Rajesh Dhiman -
Miguel Campos -
Top comments (9)
Out of curiosity, what's your motivation for learning C? I think that trying something like making HTTP requests and parsing JSON is going to be very frustrating if you're just trying to learn, and depending on what you intend to use it for, may not be something you end up doing in C anyway!
I am trying to build a service that makes post request to an API that provides IVR functionalities and handles the response and manages many things such as retries, call status, etc
Just wanted to try doing some http stuff with C
Any particular reason you want to do this in C rather than a higher-level language (eg. running on an embedded device)? Or just as an exercise to learn C?
I use CURL and cJSON for these issues.
You can see some examples for GET and POST requests in this parser program. You would be interested in
get_weather()
(and its two parser functions) andget_portfolio_value()
/parse_portfolio_json()
for GET requests and parsing the jsons andget_token()
as an example of a POST request.Hilde
I've never tried it, but this framework looks interesting: kore.io/
Here's an example using yajl to parse JSON:
git.kore.io/kore/file/examples/jso...
Although it is not in plain C (ANSI C) check this out
github.com/nlohmann/json
{
"piGroup":" ",
"nonSerializedScanData": [],
"serializedScanData": [],
"piType": "MINI",
"isLastUser": true,
"sessionId": ""
}
Thanks a lot !!
Some comments may only be visible to logged-in visitors. Sign in to view all comments.