-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
As a sanity check, does this work?
That should write a file called output.data with the HTML from https://www.wikipedia.org and print out the number of bytes each time the write callback receives data for processing.
On my machine, it prints the following when it works successfully (byte counts may vary for you):
If I change the URL to nonsense instead to make it fail, it prints text like this on my system:
Edit: corrected missing line in source (i.e. added line with CURLOPT_ERRORBUFFER which is needed to get extra info in the error buffer on failure, of course)
Edit 2: tweaks to wording to try to be more clear
Its not working unfortunatly.
Does hello world work? You should've gotten at least some console output.
That works perfectly
Try adding some prints to stderr through my earlier test program then and see if you can find where it stops giving you output. Does output work before
curl_easy_init
? After it? Somewhere later on?Note that I did update the program to add the line with
CURLOPT_ERRORBUFFER
-- that's not strictly needed, but might provide more debug info if something goes wrong later in the program. (Forgot to add the setup line initially despite writing the rest of it... 🤦♂️️)You could also try adding
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
to get it to explain more details about what it's doing internally if you can get it to print output at all.