Make an HTTP Request with the C Programming Language

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024
  • Line-by-line details on how to send an HTTP request using C and the libcurl C library.
    ----
    GitHub repo for the C program I made in this video: github.com/jos...
    GitHub repo for the Mastodon status update HTTP post that I mentioned: github.com/jos...
    The HTTP request URL I use in this video: calapi.inadiuto...
    Docs for the liturgical calendar API: calapi.inadiuto...
    Info on liturgical day rankings: www.dio.org/up...

Комментарии • 39

  • @butcracjack
    @butcracjack Месяц назад

    fire vid bro! Super stoked I now have the ability to make HTTP requests in C. Keep it hundo

  • @weirddan455
    @weirddan455 2 года назад +12

    9:14 I think "segementation fault" is not supposed to be part of the response :P

  • @romania-n6q
    @romania-n6q 2 года назад

    thanks you sir for the effort you put in this video

  • @tintun9419
    @tintun9419 3 года назад +2

    Hello bro, please make a video about post request in C++ using the cpr library

  • @sanjeevsawargi552
    @sanjeevsawargi552 Год назад

    Nice video bro!

  • @elvisedmar6629
    @elvisedmar6629 3 года назад +1

    Ty, very good video

    • @CodeAndCrux
      @CodeAndCrux  3 года назад

      I’m glad! Thanks for the comment

  • @subhraneelmukhopadhyay309
    @subhraneelmukhopadhyay309 Год назад

    I'm getting an error "cannot convert 'CURLcode' to 'const char*'"

  • @judeurban1456
    @judeurban1456 2 года назад +1

    Thanks joe

  • @findjonmoses
    @findjonmoses Год назад

    I am trying to learn C++ after years using Python, PHP and JavaScript. I know this is C code but would it be any different if done in C++? Also why doesn’t C++ have much info on restful API calls?

    • @budgetarms
      @budgetarms 8 месяцев назад

      because it is C++

  • @natalyrocha7840
    @natalyrocha7840 Год назад

    Hi there, thank you for the info! Do you know if there is the posibility to show a loading state? For example in the UI I would like to show a loader and disable a button while the request resolves.

  • @dipeshsamrawat7957
    @dipeshsamrawat7957 11 месяцев назад

    Thanks broh.

  • @nonetrix3066
    @nonetrix3066 2 года назад +3

    I'm getting expected ‘const char *’ but argument is of type ‘CURLcode’ when I try to do anything I think you need a write callback function but I want to understand what the function does before I put it in my code

  • @kotvkvante22
    @kotvkvante22 Год назад

    good video, hope you will be more confident

  • @fancywaifu9821
    @fancywaifu9821 2 года назад +1

    I assume this doesn’t work with https request?

    • @CodeAndCrux
      @CodeAndCrux  2 года назад +2

      It should. I believe I have used the same or very similar code to make https requests in the past.

    • @fancywaifu9821
      @fancywaifu9821 2 года назад

      @@CodeAndCrux Thanks!

  • @Bodybuilder900ml
    @Bodybuilder900ml Год назад

    Can you do an openssl video with an emphasis on hmac? Really clean tutorial 👍🏻

  • @turdwarbler
    @turdwarbler Год назад +2

    so you really havent used C to do a http request at all, you used libcurb which hides all the details. AND it seg faulted. Not great for an instructional video my friend.

    • @damca3160
      @damca3160 Год назад +1

      True, but still better than nothing

  • @blitzpark1250
    @blitzpark1250 3 года назад +2

    Hey man how do you use external proxy in curl?

    • @CodeAndCrux
      @CodeAndCrux  3 года назад

      I am not sure about that one. Sorry!

  • @deehanchowdhury1230
    @deehanchowdhury1230 3 года назад +1

    I cannot compile curl in windows 10, version 2004, getting error :'curl/curl.h' no such file or directory. what to do?

    • @CodeAndCrux
      @CodeAndCrux  3 года назад +2

      That typically means you need to install the libcurl library on the computer where you are trying to run the program. Follow the install instructions here: stackoverflow.com/questions/4530780/curl-curl-h-on-windows

    • @deehanchowdhury1230
      @deehanchowdhury1230 3 года назад +1

      @@CodeAndCrux Actually I have seen the answers in this particular post but all the libcurl library links are outdated :(

    • @orcave8802
      @orcave8802 2 года назад +1

      @@deehanchowdhury1230 hey are you using visual studio or other text editor? . If you're using a text editor instead of an IDE it may get a little complicated as you have to compile everything manually. What you can do is download vcpkg and cmake! If you never heard of it. It's basically a tool that will help you install packages like curl ! You can simply search for vcpkg they have a well documented tutorial on how to use it. You'll just have to install the library there and it will do everything for you. The thing is if you're using a text editor vscode for example! You have to specify the path and toolchaine yourself. So if you want something quick go for visual studio for less configurations.

  • @Bodybuilder900ml
    @Bodybuilder900ml Год назад

    Napoleon Dynamiiiiiiite

  • @farooqahmed4954
    @farooqahmed4954 2 года назад

    Hi can anyone help me for postdata method?

  • @florianunterfrauner2041
    @florianunterfrauner2041 Год назад +1

    printf(response) makes an error!

    • @trikkee
      @trikkee 11 месяцев назад +1

      Add two argument in printf function like : "%u", response

    • @randolphzhang652
      @randolphzhang652 10 месяцев назад

      @@trikkee This helped, thank you

  • @pronone3
    @pronone3 3 года назад

    Is this method related as fast ?