Jump to content

reading data from a website?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
8 replies to this topic

#1
ClemsonCS

ClemsonCS

    Newbie

  • Members
  • PipPip
  • 28 posts
I want to parse some html in C. How can I read the source code of a website to stdin? I would like to redirect it from the command line if thats possible.

#2
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
First word, libcCurl.
Second word, google!

#3
ClemsonCS

ClemsonCS

    Newbie

  • Members
  • PipPip
  • 28 posts
I tried google before but couldnt find anything because I didnt really know what to search. I will try that keyword though! thanks

#4
Nathandelane

Nathandelane

    Newbie

  • Members
  • PipPip
  • 22 posts
You could also create a Socket on port 80 and send a raw request to the website in question - you'd be doing a bit of reinventing the wheel on the one hand, but you might learn more about why and how things work if you do. Also you may not need all of the stuff in libcurl. Anyway, it's an option.

#5
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
libcurl can be recompiled with many, many flags to limit what gets compiled if you are size-wary. But even then, its tiny, nothing.

#6
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
I found some links for you. If you're unfamiliar with socket programming, check out the socket tutorial first.

BSD Sockets: A Quick And Dirty Primer
HTTP Made Really Easy <--this is what you want

#7
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
The best tutorial on sockets is, in my opinion, Beej's guide.
Beej's Guide to Network Programming

#8
Rothzael

Rothzael

    Newbie

  • Members
  • PipPip
  • 27 posts
I just completed a full-on website script, completely re-invented the wheel. I'm telling you, it's worth it. You learn a lot.

#9
ClemsonCS

ClemsonCS

    Newbie

  • Members
  • PipPip
  • 28 posts
Alright when I have some free time Ill learn socket programming. It looks pretty advanced for me since I am only a freshman in comp sci but i guess ill have to learn it eventually.