-8
Why isn't libcurl doing anything?
(lemm.ee)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
Unless I'm mistaken, that first example as-written will ~~fetch~~ POST the network resource and then immediately clean up. The fact that CURLOPT_NOPROGRESS is passed means that the typical progress bar for
curl
in an interactive shell will be suppressed. The comment in the code even says that to make the example do something useful, you'll have to pass callback pointers, possibly by way of CURLOPT_WRITEFUNCTION or CURLOPT_WRITEDATA.From the
curl_easy_perform()
man page:Ah, right.
Finished it, i think. Still does "nothing"
edit: probably shouldn't include my api key with it.
I'm on mobile so I can't compile this myself, but can you clarify on what you're observing? Does "nothing" mean no output to stdout and stderr? Or that you did get an error message but it's not dispositive as to what libcurl was doing? Presumably the next step would be to validate that the program is executing at all, either with a debugger or printf-style debug statements at all junctures.
Please include as much detail as you can, since this is now more akin to a bug report.
EDIT: wait a sec. What exactly is this example code meant to do? The Pastebin API call suggests that this is meant to upload a payload to the web, not pull it down. But CURLOPT_WRITEFUNCTION is for receiving data from a URI. What is your intention with running this example program?
I'm trying to send a post request to Pastebins api to make a paste. This is one of the first programs I have tried to write with libcurl, so its probably wrong.
What exactly are you expecting to happen? Have you written code before?
I have written code before. I just started with C recently. I am expecting it to do literally anything at this point, but for some reason whenever I use the libcurl library literally nothing happens that i can observe.