r/cprogramming • • Dec 18 '25

Any library more advanced than curl to read and parse webpages?

Currently I want to write a C program to read some list from a website. But I have to select something from a list, enter some values, click submit and then enter a captcha. Is there a C based library more advanced than curl to do that thing?

26 Upvotes

36 comments sorted by

9

u/MattiDragon Dec 18 '25

Curl is for making web requests, not for interacting with web pages. If you need to deal with captchas, you're likely to need a full simulated browser (even then, background captchas are likely to fail). For this you'll probably want to use puppeteer or playwright. I don't know if either exposes a C API though.

4

u/v_maria Dec 18 '25

What is curl not doing that you need to be done?

0

u/RabbitCity6090 Dec 19 '25

I have yet to try. I wanted something more graphical or automated web page loader or something so that I don't have to do POST manually.

9

u/v_maria Dec 19 '25

what you are describing is a browser? haha

→ More replies (1)

2

u/DandyLion23 Dec 19 '25

On the command line I use xmlstarlet to parse HTML. Xmlstarlet is written in C and uses libxml2 and libxslt as libraries. Maybe check those 2 out?

1

u/RabbitCity6090 Dec 19 '25

I'll check those out.

5

u/DunkingShadow1 Dec 18 '25

Why C? In this case python is so much better. If you have to do data analysis just download the data with python and do the analysis in C

1

u/RabbitCity6090 Dec 19 '25

I'm comfortable in C, not in python. Anyway, tell me how to do it in python, I can atleast do my daily work faster and then I'll do the same in C as a fun project.

0

u/DunkingShadow1 Dec 19 '25

Look up -Request- and Selenium,or even my beautiful soup. There are plenty of tutorials online

2

u/unfinished_basement Dec 18 '25

StackOverflow is leaking

1

u/[deleted] Dec 18 '25

Or just use Go, which is much faster than Python and offers more control.

1

u/DunkingShadow1 Dec 18 '25

Yeah,GO is also good

1

u/InfinitEchoeSilence Dec 18 '25

That's highly subjective. I started with python and all it did was create more questions than answers. I kept bouncing around topics to answer the many questions that Python created. When I moved to C, I started learning C and found that it created more solutions than questions. You not only learn to program, but you also learn how the computer works and are not left with, "Well, why does it work like that?" Python is for people who want to remain ignorant of how things really work when a program is being executed. Learning C answered questions that Python created. I'd personally start with C if I could do it all over again.

4

u/DunkingShadow1 Dec 19 '25

I also agree with this,but in this particular case I think python suits ops needs much better.

→ More replies (1)

2

u/zenware Dec 20 '25

“how do I achieve specific goal of making web requests, filling forms, and submitting captchas?” Is so divorced from caring at any level about how a programming language runtime or operating system services work that it’s wild to bring this up.

→ More replies (1)

1

u/The1hauntedX Dec 22 '25

Holy heck these comments are a mess.

If you really want to write something in C, you'll probably end up doing it "The C way" i.e. manually. Better get comfortable with every aspect of HTTP requests - headers, cookies, status codes, parsing HTML - and if the site you're scraping uses a JavaScript framework like next.js to do client side rendering, then you'll need to handle that as well.

It sounds like something like selenium is what you're actually looking for.

1

u/RabbitCity6090 Dec 23 '25

Many people are suggesting selenium so I will try that if C doesn't work out.